Commit 75ce4c4f authored by Xavier Thompson's avatar Xavier Thompson

[fix] Add each .egg and .dist-info to environment

Since zc.buildout uses `pip` to install dists, most .egg in ./eggs and
./develop-eggs (in case of dists installed with zc.recipe.egg:custom)
are not actually eggs, but installed wheels with .dist-info format
which have been bundled into a .egg containing .dist-info metadata
folder as well as the actual package folder directly alongside.

Unlike actual eggs, such */*.dist-info bundles are not stepped into
by package_resources when the containing directory is add to the
environment, so each .egg bundle needs to be added individually.

Buildout already does this for bundles in the target directory of
egg installation, usually ./eggs, but e.g. in offline mode there
is no target directory and then already installed .egg bundles
are not detected.

So now every dist path is added to the environment individual,
including for paths where buildout looks for already installed
eggs but will not install eggs to, such as ./develop-eggs, and
also ./eggs in offline mode or when using zc.recipe.egg:custom
and the target is ./develop-eggs and ./eggs is such a scan-from
but don't-install-to path.
parent 6ad8b7fb
......@@ -295,7 +295,7 @@ class Installer(object):
self._versions = normalize_versions(versions)
def _make_env(self):
full_path = self._get_dest_dist_paths() + self._path
full_path = self._get_dest_dist_paths() + self._get_path_dist_paths() + self._path
env = pkg_resources.Environment(full_path)
# this needs to be called whenever self._env is modified (or we could
# make an Environment subclass):
......@@ -310,9 +310,18 @@ class Installer(object):
dest = self._dest
if dest is None:
return []
eggs = glob.glob(os.path.join(dest, '*.egg'))
return self._get_dist_paths(dest)
def _get_path_dist_paths(self):
dist_paths = []
for path in self._path:
dist_paths.extend(self._get_dist_paths(path))
return dist_paths
def _get_dist_paths(self, path):
eggs = glob.glob(os.path.join(path, '*.egg'))
dists = [os.path.dirname(dist_info) for dist_info in
glob.glob(os.path.join(dest, '*', '*.dist-info'))]
glob.glob(os.path.join(path, '*', '*.dist-info'))]
return list(set(eggs + dists))
@staticmethod
......
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