Commit 18a5432c authored by Xavier Thompson's avatar Xavier Thompson

[tmp]: Rename false eggs into .buildout-egg

parent ad41eed4
...@@ -248,6 +248,15 @@ def dist_needs_pkg_resources(dist): ...@@ -248,6 +248,15 @@ def dist_needs_pkg_resources(dist):
) )
class Environment(pkg_resources.Environment):
def __init__(self, paths):
super(Environment, self).__init__(paths)
for project_name in self:
for dist in self[project_name]:
if dist.location.endswith('.buildout-egg'):
dist.precedence = pkg_resources.EGG_DIST
_doing_list = type('', (), {'__mod__': staticmethod( _doing_list = type('', (), {'__mod__': staticmethod(
lambda x: '\n '.join(*x))})() lambda x: '\n '.join(*x))})()
...@@ -313,7 +322,7 @@ class Installer(object): ...@@ -313,7 +322,7 @@ class Installer(object):
def _make_env(self): def _make_env(self):
full_path = self._get_dest_dist_paths() + self._get_path_dist_paths() + self._path full_path = self._get_dest_dist_paths() + self._get_path_dist_paths() + self._path
env = pkg_resources.Environment(full_path) env = Environment(full_path)
# this needs to be called whenever self._env is modified (or we could # this needs to be called whenever self._env is modified (or we could
# make an Environment subclass): # make an Environment subclass):
self._eggify_env_dest_dists(env, self._dest) self._eggify_env_dest_dists(env, self._dest)
...@@ -337,9 +346,10 @@ class Installer(object): ...@@ -337,9 +346,10 @@ class Installer(object):
def _get_dist_paths(self, path): def _get_dist_paths(self, path):
eggs = glob.glob(os.path.join(path, '*.egg')) eggs = glob.glob(os.path.join(path, '*.egg'))
buildout_eggs = glob.glob(os.path.join(path, '*.buildout-egg'))
dists = [os.path.dirname(dist_info) for dist_info in dists = [os.path.dirname(dist_info) for dist_info in
glob.glob(os.path.join(path, '*', '*.dist-info'))] glob.glob(os.path.join(path, '*', '*.dist-info'))]
return list(set(eggs + dists)) return list(set(eggs + buildout_eggs + dists))
@staticmethod @staticmethod
def _eggify_env_dest_dists(env, dest): def _eggify_env_dest_dists(env, dest):
...@@ -462,7 +472,7 @@ class Installer(object): ...@@ -462,7 +472,7 @@ class Installer(object):
paths = call_pip_install(spec, tmp, self) paths = call_pip_install(spec, tmp, self)
dists = [] dists = []
env = pkg_resources.Environment(paths) env = Environment(paths)
for project in env: for project in env:
dists.extend(env[project]) dists.extend(env[project])
...@@ -817,7 +827,7 @@ class Installer(object): ...@@ -817,7 +827,7 @@ class Installer(object):
# Note that we don't use the existing environment, because we want # Note that we don't use the existing environment, because we want
# to look for new eggs unless what we have is the best that # to look for new eggs unless what we have is the best that
# matches the requirement. # matches the requirement.
env = pkg_resources.Environment(ws.entries) env = Environment(ws.entries)
while requirements: while requirements:
# Process dependencies breadth-first. # Process dependencies breadth-first.
...@@ -1933,7 +1943,7 @@ def make_egg_after_pip_install(dest, distinfo_dir): ...@@ -1933,7 +1943,7 @@ def make_egg_after_pip_install(dest, distinfo_dir):
base = "{}-{}".format( base = "{}-{}".format(
distro.egg_name(), pkg_resources.get_supported_platform() distro.egg_name(), pkg_resources.get_supported_platform()
) )
egg_name = base + '.egg' egg_name = base + '.buildout-egg'
new_distinfo_dir = base + '.dist-info' new_distinfo_dir = base + '.dist-info'
egg_dir = os.path.join(dest, egg_name) egg_dir = os.path.join(dest, egg_name)
os.mkdir(egg_dir) os.mkdir(egg_dir)
...@@ -2036,7 +2046,7 @@ def _get_matching_dist_in_location(dist, location): ...@@ -2036,7 +2046,7 @@ def _get_matching_dist_in_location(dist, location):
# may be normalized (e.g., 3.3 becomes 3.3.0 when downloaded from # may be normalized (e.g., 3.3 becomes 3.3.0 when downloaded from
# PyPI.) # PyPI.)
env = pkg_resources.Environment([location]) env = Environment([location])
dists = [ d for project_name in env for d in env[project_name] ] dists = [ d for project_name in env for d in env[project_name] ]
dist_infos = [ (d.project_name.lower(), d.parsed_version) for d in dists ] dist_infos = [ (d.project_name.lower(), d.parsed_version) for d in dists ]
if dist_infos == [(dist.project_name.lower(), dist.parsed_version)]: if dist_infos == [(dist.project_name.lower(), dist.parsed_version)]:
......
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