aboutsummaryrefslogtreecommitdiffstats
path: root/pkg_resources/__init__.py
diff options
context:
space:
mode:
authorJason R. Coombs <jaraco@jaraco.com>2018-09-16 11:48:44 -0400
committerGitHub <noreply@github.com>2018-09-16 11:48:44 -0400
commit5c8ff5a17840790b68d75e47652264f4f9931101 (patch)
treea67cf9d4d5b2d7c23fb7359b3689a370f63042ca /pkg_resources/__init__.py
parent9e23b6d3e046113e8546e9fe084c112e809af795 (diff)
parentec1a8f60134fb409c9b747cb15e0b5efbd519874 (diff)
downloadexternal_python_setuptools-5c8ff5a17840790b68d75e47652264f4f9931101.tar.gz
external_python_setuptools-5c8ff5a17840790b68d75e47652264f4f9931101.tar.bz2
external_python_setuptools-5c8ff5a17840790b68d75e47652264f4f9931101.zip
Merge pull request #1402 from daa/pkg-resources-always-handle-namespace-package-path
Improved handling of module __path__ attribute for namespace packages, fixes #1321
Diffstat (limited to 'pkg_resources/__init__.py')
-rw-r--r--pkg_resources/__init__.py11
1 files changed, 6 insertions, 5 deletions
diff --git a/pkg_resources/__init__.py b/pkg_resources/__init__.py
index a8b5319f..84a4b34b 100644
--- a/pkg_resources/__init__.py
+++ b/pkg_resources/__init__.py
@@ -2144,12 +2144,13 @@ def _rebuild_mod_path(orig_path, package_name, module):
parts = path_parts[:-module_parts]
return safe_sys_path_index(_normalize_cached(os.sep.join(parts)))
- if not isinstance(orig_path, list):
- # Is this behavior useful when module.__path__ is not a list?
- return
+ new_path = sorted(orig_path, key=position_in_sys_path)
+ new_path = [_normalize_cached(p) for p in new_path]
- orig_path.sort(key=position_in_sys_path)
- module.__path__[:] = [_normalize_cached(p) for p in orig_path]
+ if isinstance(module.__path__, list):
+ module.__path__[:] = new_path
+ else:
+ module.__path__ = new_path
def declare_namespace(packageName):