Commit bd621219 authored by Jason R. Coombs's avatar Jason R. Coombs

Extract method for calculating namespace packages for single_version_externally_managed

parent e8914480
...@@ -17,19 +17,31 @@ class install_lib(orig.install_lib): ...@@ -17,19 +17,31 @@ class install_lib(orig.install_lib):
excluded for single_version_externally_managed installations. excluded for single_version_externally_managed installations.
""" """
exclude = set() exclude = set()
nsp = self.distribution.namespace_packages for pkg in self._get_SVEM_NSPs():
svem = (nsp and self.get_finalized_command('install') parts = pkg.split('.')
.single_version_externally_managed) while parts:
if svem: pkgdir = os.path.join(self.install_dir, *parts)
for pkg in nsp: for f in self._gen_exclude_names():
parts = pkg.split('.') exclude.add(os.path.join(pkgdir, f))
while parts: parts.pop()
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 return exclude
def _get_SVEM_NSPs(self):
"""
Get namespace packages (list) but only for
single_version_externally_managed installations and empty otherwise.
"""
# TODO: is it necessary to short-circuit here? i.e. what's the cost
# if get_finalized_command is called even when namespace_packages is
# False?
if not self.distribution.namespace_packages:
return []
install_cmd = self.get_finalized_command('install')
svem = install_cmd.single_version_externally_managed
return self.distribution.namespace_packages if svem else []
@staticmethod @staticmethod
def _gen_exclude_names(): def _gen_exclude_names():
""" """
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment