Skip to content

Commit

Permalink
Merge pull request pypa#2311 from dstufft/fix-windows-more
Browse files Browse the repository at this point in the history
Remove some other places we called os.geteuid()
(cherry picked from commit 40ef6da)
  • Loading branch information
dstufft committed Jan 3, 2015
1 parent 6f32138 commit 86205b1
Show file tree
Hide file tree
Showing 6 changed files with 7 additions and 6 deletions.
2 changes: 2 additions & 0 deletions CHANGES.txt
@@ -1,5 +1,7 @@
**6.0.6 (2015-01-03)**

* Continue the regression fix from 6.0.5 which was not a complete fix.


**6.0.5 (2015-01-03)**

Expand Down
2 changes: 1 addition & 1 deletion pip/basecommand.py
Expand Up @@ -119,7 +119,7 @@ def main(self, args):

# Ensure that the path for our debug log is owned by the current user
# and if it is not, disable the debug log.
write_debug_log = check_path_owner(debug_log_path, os.geteuid())
write_debug_log = check_path_owner(debug_log_path)

logging_dictConfig({
"version": 1,
Expand Down
2 changes: 1 addition & 1 deletion pip/download.py
Expand Up @@ -234,7 +234,7 @@ def __init__(self, *args, **kwargs):
# we will check the parent directory until we find one that does exist.
# If it is not owned by the user executing pip then we will disable
# the cache and log a warning.
if not check_path_owner(self.directory, os.geteuid()):
if not check_path_owner(self.directory):
logger.warning(
"The directory '%s' or its parent directory is not owned by "
"the current user and the cache has been disabled. Please "
Expand Down
2 changes: 1 addition & 1 deletion pip/utils/filesystem.py
Expand Up @@ -4,7 +4,7 @@
from pip.compat import get_path_uid


def check_path_owner(path, uid):
def check_path_owner(path):
# If we don't have a way to check the effective uid of this process, then
# we'll just assume that we own the directory.
if not hasattr(os, "geteuid"):
Expand Down
3 changes: 1 addition & 2 deletions pip/utils/outdated.py
Expand Up @@ -60,8 +60,7 @@ def __init__(self):

def save(self, pypi_version, current_time):
# Check to make sure that we own the directory
if not check_path_owner(
os.path.dirname(self.statefile_path), os.geteuid()):
if not check_path_owner(os.path.dirname(self.statefile_path)):
return

# Now that we've ensured the directory is owned by this user, we'll go
Expand Down
2 changes: 1 addition & 1 deletion tests/unit/test_unit_outdated.py
Expand Up @@ -128,7 +128,7 @@ def fake_open(filename, mode='r'):
def fake_lock(filename):
yield

monkeypatch.setattr(outdated, "check_path_owner", lambda p, u: True)
monkeypatch.setattr(outdated, "check_path_owner", lambda p: True)

monkeypatch.setattr(lockfile, 'LockFile', fake_lock)

Expand Down

0 comments on commit 86205b1

Please sign in to comment.