Skip to content

Commit

Permalink
Fixing _NamespacePath sort method - pypa#4935 error
Browse files Browse the repository at this point in the history
Fixing the error "_NamespacePath object has no attribute sort", cited in pypa#4935, by transforming the object NameSpace into a list to permit sorting by `position_in_sys_path`.
  • Loading branch information
cdutr committed Mar 21, 2018
1 parent 2634beb commit ca01103
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/pip/_vendor/pkg_resources/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2227,8 +2227,9 @@ def position_in_sys_path(path):
# Is this behavior useful when module.__path__ is not a list?
return

orig_path.sort(key=position_in_sys_path)
module.__path__[:] = [_normalize_cached(p) for p in orig_path]
orig_path_t = list(orig_path)
orig_path_t.sort(key=position_in_sys_path)
module.__path__[:] = [_normalize_cached(p) for p in orig_path_t]


def declare_namespace(packageName):
Expand Down

0 comments on commit ca01103

Please sign in to comment.