aboutsummaryrefslogtreecommitdiffstats
path: root/pkg_resources/__init__.py
diff options
context:
space:
mode:
authorAlexander Duryagin <aduryagin@gmail.com>2018-06-27 21:32:11 +0300
committerAlexander Duryagin <aduryagin@gmail.com>2018-06-27 21:32:11 +0300
commit776096522af8d8320b879571ded2b1c43242c0da (patch)
treeb50227696ed5fc7b28c2c5e449eab7639742972f /pkg_resources/__init__.py
parent5c816483500519a07a3db4364daaced379780eb7 (diff)
downloadexternal_python_setuptools-776096522af8d8320b879571ded2b1c43242c0da.tar.gz
external_python_setuptools-776096522af8d8320b879571ded2b1c43242c0da.tar.bz2
external_python_setuptools-776096522af8d8320b879571ded2b1c43242c0da.zip
always process module.__path__ 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 67015408..d642a405 100644
--- a/pkg_resources/__init__.py
+++ b/pkg_resources/__init__.py
@@ -2135,12 +2135,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):