Commit bf8d269f authored by Xavier Thompson's avatar Xavier Thompson

Fix bootstrap to let it install recent zc.buildout

Remove hardcoded dependencies of zc.buildout in bootstrap: easy_install
will anyway install all the actual dependencies of the pinned version
of zc.buildout, and return a working set containing them all.

Before this, when the pinned zc.buildout had other dependencies than
the ones hardcoded, they were installed correctly but bootstrap took
only the hardcoded ones into account and wrongly failed due to the
other dependencies being missing.

This is needed for buildout 3 because the dependencies now include
pip and wheel in addition to setuptools.
parent e9c39301
...@@ -540,41 +540,37 @@ class Buildout(DictMixin): ...@@ -540,41 +540,37 @@ class Buildout(DictMixin):
# Now copy buildout and setuptools eggs, and record destination eggs: # Now copy buildout and setuptools eggs, and record destination eggs:
entries = [] entries = []
options = self['buildout'] options = self['buildout']
distributions = ['zc.buildout', 'setuptools'] distributions = ['zc.buildout']
try: try:
import slapos.libnetworkcache import slapos.libnetworkcache
except ImportError: except ImportError:
pass pass
else: else:
distributions.append('slapos.libnetworkcache') distributions.append('slapos.libnetworkcache')
for name in distributions: # Install buildout and dependent eggs following pinned versions.
if [x for x in sys.argv if \ dest = options['eggs-directory']
(name == 'setuptools' and \ path = [options['develop-eggs-directory']]
re.match(r'^--setuptools-version(=|$)', x)) or \ if self.offline:
(name == 'zc.buildout' and \ # Cannot install: just check requirements are already met
re.match(r'^--buildout-version(=|$)', x))]: path.append(dest)
# Specified version is already installed by bootstrap script. dest = None
ws = pkg_resources.working_set
elif self.offline:
ws = zc.buildout.easy_install.working_set(
[name], options['executable'],
[options['develop-eggs-directory'],
options['eggs-directory']],
)
else:
ws = zc.buildout.easy_install.install( ws = zc.buildout.easy_install.install(
[name], options['eggs-directory'], distributions,
dest,
links=self._links, links=self._links,
index=options.get('index'), index=options.get('index'),
path=[options['develop-eggs-directory']], path=path,
newest=self.newest, newest=self.newest,
allow_hosts=self._allow_hosts, allow_hosts=self._allow_hosts,
) )
r = pkg_resources.Requirement.parse(name) # If versions aren't pinned or if current modules match,
dist = ws.find(r) # nothing will be installed, but then we'll copy them to
# the local eggs or develop-eggs folder just after this.
for dist in ws:
if dist.precedence == pkg_resources.DEVELOP_DIST: if dist.precedence == pkg_resources.DEVELOP_DIST:
dest = os.path.join(options['develop-eggs-directory'], dest = os.path.join(options['develop-eggs-directory'],
name+'.egg-link') dist.key + '.egg-link')
with open(dest, 'w') as f: with open(dest, 'w') as f:
f.write(dist.location) f.write(dist.location)
entries.append(dist.location) entries.append(dist.location)
......
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