diff options
author | Jason R. Coombs <jaraco@jaraco.com> | 2016-12-07 20:57:11 -0500 |
---|---|---|
committer | Jason R. Coombs <jaraco@jaraco.com> | 2016-12-07 20:57:11 -0500 |
commit | 41a9da1833b1f55b4a3da0d427e9b569075f0cc7 (patch) | |
tree | 75db39a8d81c20d9072856e65b9c282cc6a44eda /setuptools/namespaces.py | |
parent | 7e25fd910d1ff5259c0768d3b54a9bf03bce4279 (diff) | |
download | external_python_setuptools-41a9da1833b1f55b4a3da0d427e9b569075f0cc7.tar.gz external_python_setuptools-41a9da1833b1f55b4a3da0d427e9b569075f0cc7.tar.bz2 external_python_setuptools-41a9da1833b1f55b4a3da0d427e9b569075f0cc7.zip |
module_from_spec is only available on Python 3.5
Diffstat (limited to 'setuptools/namespaces.py')
-rwxr-xr-x | setuptools/namespaces.py | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/setuptools/namespaces.py b/setuptools/namespaces.py index b6720609..9266860f 100755 --- a/setuptools/namespaces.py +++ b/setuptools/namespaces.py @@ -1,4 +1,5 @@ import os +import sys from distutils import log import itertools @@ -42,7 +43,10 @@ class Installer: "sys.modules.setdefault(%(pkg)r, " "importlib.util.module_from_spec(" "importlib.machinery.PathFinder.find_spec(%(pkg)r, " - "[os.path.dirname(p)])))", + "[os.path.dirname(p)])))" + if sys.version_info >= (3, 5) else + "m = not ie and not pep420 and " + "sys.modules.setdefault(%(pkg)r, types.ModuleType(%(pkg)r))", "mp = (m or []) and m.__dict__.setdefault('__path__',[])", "(p not in mp) and mp.append(p)", ) |