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 ws = zc.buildout.easy_install.install(
elif self.offline: distributions,
ws = zc.buildout.easy_install.working_set( dest,
[name], options['executable'], links=self._links,
[options['develop-eggs-directory'], index=options.get('index'),
options['eggs-directory']], path=path,
) newest=self.newest,
else: allow_hosts=self._allow_hosts,
ws = zc.buildout.easy_install.install( )
[name], options['eggs-directory'], # If versions aren't pinned or if current modules match,
links=self._links, # nothing will be installed, but then we'll copy them to
index=options.get('index'), # the local eggs or develop-eggs folder just after this.
path=[options['develop-eggs-directory']],
newest=self.newest, for dist in ws:
allow_hosts=self._allow_hosts,
)
r = pkg_resources.Requirement.parse(name)
dist = ws.find(r)
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