aboutsummaryrefslogtreecommitdiffstats
path: root/setuptools/command/install_lib.py
diff options
context:
space:
mode:
Diffstat (limited to 'setuptools/command/install_lib.py')
-rw-r--r--setuptools/command/install_lib.py17
1 files changed, 13 insertions, 4 deletions
diff --git a/setuptools/command/install_lib.py b/setuptools/command/install_lib.py
index bf587a04..88b35972 100644
--- a/setuptools/command/install_lib.py
+++ b/setuptools/command/install_lib.py
@@ -17,15 +17,24 @@ class install_lib(orig.install_lib):
excluded for single_version_externally_managed installations.
"""
exclude = set()
- for pkg in self._get_SVEM_NSPs():
- parts = pkg.split('.')
- while parts:
+ for ns_pkg in self._get_SVEM_NSPs():
+ for pkg in self._all_packages(ns_pkg):
+ parts = pkg.split('.')
pkgdir = os.path.join(self.install_dir, *parts)
for f in self._gen_exclude_names():
exclude.add(os.path.join(pkgdir, f))
- parts.pop()
return exclude
+ @staticmethod
+ def _all_packages(pkg_name):
+ """
+ >>> list(install_lib._all_packages('foo.bar.baz'))
+ ['foo.bar.baz', 'foo.bar', 'foo']
+ """
+ while pkg_name:
+ yield pkg_name
+ pkg_name, sep, child = pkg_name.partition('.')
+
def _get_SVEM_NSPs(self):
"""
Get namespace packages (list) but only for