From 355603259aa37e424cf7466c3de6518375a935e3 Mon Sep 17 00:00:00 2001 From: "Jason R. Coombs" Date: Sun, 6 Nov 2016 16:41:23 -0500 Subject: Add uninstall support for namespace packages --- setuptools/namespaces.py | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'setuptools/namespaces.py') diff --git a/setuptools/namespaces.py b/setuptools/namespaces.py index cc934b7e..a6371c99 100755 --- a/setuptools/namespaces.py +++ b/setuptools/namespaces.py @@ -30,6 +30,14 @@ 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 -- cgit v1.2.3 From 712a6d85e47979ac50a1fb32d2cc76dc61acade8 Mon Sep 17 00:00:00 2001 From: "Jason R. Coombs" Date: Mon, 7 Nov 2016 04:18:56 -0500 Subject: In -nspkg.pth, always add the path to the namespace package, even if a __init__ exists, allowing for better cooperation between PEP 420 packages and older, __init__ namespace packages. --- setuptools/namespaces.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'setuptools/namespaces.py') diff --git a/setuptools/namespaces.py b/setuptools/namespaces.py index a6371c99..93d358a2 100755 --- a/setuptools/namespaces.py +++ b/setuptools/namespaces.py @@ -45,8 +45,7 @@ class Installer: "import sys, types, os", "pep420 = sys.version_info > (3, 3)", "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 " + "m = 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)", -- cgit v1.2.3 From 2268fb9887cfea2e28e156bd2c8314132261402f Mon Sep 17 00:00:00 2001 From: "Jason R. Coombs" Date: Sun, 13 Nov 2016 09:21:40 -0500 Subject: Provisionally revert the -nspkg.pth suppression on PEP 420 Pythons. Ref #250. --- setuptools/namespaces.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'setuptools/namespaces.py') diff --git a/setuptools/namespaces.py b/setuptools/namespaces.py index 93d358a2..9c1f0243 100755 --- a/setuptools/namespaces.py +++ b/setuptools/namespaces.py @@ -45,7 +45,7 @@ class Installer: "import sys, types, os", "pep420 = sys.version_info > (3, 3)", "p = os.path.join(%(root)s, *%(pth)r)", - "m = not pep420 and " + "m = " "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)", -- cgit v1.2.3