Commit 6843ab97 authored by Kazuhiko Shiozaki's avatar Kazuhiko Shiozaki Committed by Julien Muchembled

Respect specified versions of initial eggs in bootstrap.

--setuptools-version and --buildout-version options in bootstrap script still have the priority.
parent 4f074498
...@@ -471,16 +471,39 @@ class Buildout(DictMixin): ...@@ -471,16 +471,39 @@ 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']
for name in 'setuptools', 'zc.buildout': for name in 'setuptools', 'zc.buildout':
if [x for x in sys.argv if \
(name == 'setuptools' and \
re.match(r'^--setuptools-version(=|$)', x)) or \
(name == 'zc.buildout' and \
re.match(r'^--buildout-version(=|$)', x))]:
# Specified version is already installed by bootstrap script.
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(
[name], options['eggs-directory'],
links=self._links,
index=options.get('index'),
path=[options['develop-eggs-directory']],
newest=self.newest,
allow_hosts=self._allow_hosts,
)
r = pkg_resources.Requirement.parse(name) r = pkg_resources.Requirement.parse(name)
dist = pkg_resources.working_set.find(r) dist = ws.find(r)
if dist.precedence == pkg_resources.DEVELOP_DIST: if dist.precedence == pkg_resources.DEVELOP_DIST:
dest = os.path.join(self['buildout']['develop-eggs-directory'], dest = os.path.join(options['develop-eggs-directory'],
name+'.egg-link') name+'.egg-link')
open(dest, 'w').write(dist.location) open(dest, 'w').write(dist.location)
entries.append(dist.location) entries.append(dist.location)
else: else:
dest = os.path.join(self['buildout']['eggs-directory'], dest = os.path.join(options['eggs-directory'],
os.path.basename(dist.location)) os.path.basename(dist.location))
entries.append(dest) entries.append(dest)
if not os.path.exists(dest): if not os.path.exists(dest):
...@@ -492,10 +515,9 @@ class Buildout(DictMixin): ...@@ -492,10 +515,9 @@ class Buildout(DictMixin):
# Create buildout script # Create buildout script
ws = pkg_resources.WorkingSet(entries) ws = pkg_resources.WorkingSet(entries)
ws.require('zc.buildout') ws.require('zc.buildout')
options = self['buildout']
zc.buildout.easy_install.scripts( zc.buildout.easy_install.scripts(
['zc.buildout'], ws, sys.executable, ['zc.buildout'], ws, sys.executable,
self['buildout']['bin-directory'], options['bin-directory'],
relative_paths = ( relative_paths = (
bool_option(options, 'relative-paths', False) bool_option(options, 'relative-paths', False)
and options['directory'] and options['directory']
......
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