diff options
author | Jason R. Coombs <jaraco@jaraco.com> | 2016-12-11 15:40:54 -0500 |
---|---|---|
committer | Jason R. Coombs <jaraco@jaraco.com> | 2016-12-11 15:57:23 -0500 |
commit | 67aefd1b218e5a97fb4be7830ac4b28d8eb6a26e (patch) | |
tree | 82e40eaa20e4ee8eb41f8319e84c40dc75317a07 /setuptools/namespaces.py | |
parent | acd949909b158557984ad9a4ffda401367f089c5 (diff) | |
parent | 3dd506f01d48b98aeea9bdbca0105d4c7d8ad538 (diff) | |
download | external_python_setuptools-67aefd1b218e5a97fb4be7830ac4b28d8eb6a26e.tar.gz external_python_setuptools-67aefd1b218e5a97fb4be7830ac4b28d8eb6a26e.tar.bz2 external_python_setuptools-67aefd1b218e5a97fb4be7830ac4b28d8eb6a26e.zip |
Merge branch 'develop-nspkg-always' into issue250-module_from_spec
Diffstat (limited to 'setuptools/namespaces.py')
-rwxr-xr-x | setuptools/namespaces.py | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/setuptools/namespaces.py b/setuptools/namespaces.py index ce16286f..96aa20e7 100755 --- a/setuptools/namespaces.py +++ b/setuptools/namespaces.py @@ -31,21 +31,27 @@ class Installer: with open(filename, 'wt') as f: f.writelines(lines) + def uninstall_namespaces(self): + filename, ext = os.path.splitext(self._get_target()) + filename += self.nspkg_ext + if not os.path.exists(filename): + return + log.info("Removing %s", filename) + os.remove(filename) + def _get_target(self): return self.target _nspkg_tmpl = ( "import sys, types, os, importlib.util, importlib.machinery", - "pep420 = (3, 3) < sys.version_info < (3, 5)", "has_mfs = sys.version_info > (3, 5)", "p = os.path.join(%(root)s, *%(pth)r)", - "ie = os.path.exists(os.path.join(p,'__init__.py'))", - "m = not ie and not pep420 and has_mfs and " + "m = has_mfs and " "sys.modules.setdefault(%(pkg)r, " "importlib.util.module_from_spec(" "importlib.machinery.PathFinder.find_spec(%(pkg)r, " "[os.path.dirname(p)])))", - "m = not ie and not pep420 and not has_mfs and " + "m = not has_mfs 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)", |