Skip to content

Commit 9d25d2a

Browse files
authored
Merge pull request #10566 from n1000/dont_warn_on_bsd
2 parents 75c11c4 + f231732 commit 9d25d2a

File tree

2 files changed

+5
-3
lines changed

2 files changed

+5
-3
lines changed

news/10565.bugfix.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Tweak running-as-root detection, to check ``os.getuid`` if it exists, on Unix-y and non-Linux/non-MacOS machines.

src/pip/_internal/cli/req_command.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -173,9 +173,10 @@ def warn_if_run_as_root() -> None:
173173
# checks: https://mypy.readthedocs.io/en/stable/common_issues.html
174174
if sys.platform == "win32" or sys.platform == "cygwin":
175175
return
176-
if sys.platform == "darwin" or sys.platform == "linux":
177-
if os.getuid() != 0:
178-
return
176+
177+
if os.getuid() != 0:
178+
return
179+
179180
logger.warning(
180181
"Running pip as the 'root' user can result in broken permissions and "
181182
"conflicting behaviour with the system package manager. "

0 commit comments

Comments
 (0)