Commit e129e187 authored by Jim Fulton's avatar Jim Fulton

Updated to work with the latest setuptools.

parent d05717a2
...@@ -4,8 +4,7 @@ Change History ...@@ -4,8 +4,7 @@ Change History
2.6.0 (unreleased) 2.6.0 (unreleased)
================== ==================
- Nothing changed yet. - Updated to work with the latest setuptools.
2.5.3 (2016-09-05) 2.5.3 (2016-09-05)
================== ==================
......
...@@ -11,7 +11,7 @@ zope.testing = 4.5.0 ...@@ -11,7 +11,7 @@ zope.testing = 4.5.0
[py] [py]
recipe = zc.recipe.egg recipe = zc.recipe.egg
eggs = zc.buildout eggs = zc.buildout[test]
zc.recipe.egg zc.recipe.egg
zope.testing zope.testing
interpreter = py interpreter = py
......
...@@ -98,7 +98,8 @@ Now we can run the buildout and make sure all attempts to dist.plone.org fails:: ...@@ -98,7 +98,8 @@ Now we can run the buildout and make sure all attempts to dist.plone.org fails::
Test for issues Test for issues
--------------- ---------------
Test for 1.0.5 breakage as in https://bugs.launchpad.net/zc.buildout/+bug/239212:: Test for 1.0.5 breakage as in
https://bugs.launchpad.net/zc.buildout/+bug/239212::
>>> write(sample_buildout, 'buildout.cfg', >>> write(sample_buildout, 'buildout.cfg',
... ''' ... '''
...@@ -114,8 +115,7 @@ Test for 1.0.5 breakage as in https://bugs.launchpad.net/zc.buildout/+bug/239212 ...@@ -114,8 +115,7 @@ Test for 1.0.5 breakage as in https://bugs.launchpad.net/zc.buildout/+bug/239212
>>> print_('XX'); print_(system(buildout), end='') # doctest: +ELLIPSIS >>> print_('XX'); print_(system(buildout), end='') # doctest: +ELLIPSIS
X... X...
Unused options for buildout: 'foo'. Unused options for buildout: 'foo'.
Installing python. Installing python...
Generated script '/sample-buildout/bin/buildout'.
Generated interpreter '/sample-buildout/bin/python'. Generated interpreter '/sample-buildout/bin/python'.
The bug 239212 above would have got us an *AttributeError* on The bug 239212 above would have got us an *AttributeError* on
......
...@@ -55,8 +55,8 @@ By default it gets the latest version:: ...@@ -55,8 +55,8 @@ By default it gets the latest version::
>>> print_(open(buildout_script).read()) # doctest: +ELLIPSIS >>> print_(open(buildout_script).read()) # doctest: +ELLIPSIS
#... #...
sys.path[0:0] = [ sys.path[0:0] = [
'/sample/eggs/setuptools-...egg',
'/sample/eggs/zc.buildout-22.0.0...egg', '/sample/eggs/zc.buildout-22.0.0...egg',
'/sample/eggs/setuptools-...egg'...
]... ]...
Now trying the ``--buildout-version`` option, that let you define a version Now trying the ``--buildout-version`` option, that let you define a version
...@@ -86,8 +86,8 @@ Let's make sure the generated ``buildout`` script uses it:: ...@@ -86,8 +86,8 @@ Let's make sure the generated ``buildout`` script uses it::
>>> print_(open(buildout_script).read()) # doctest: +ELLIPSIS >>> print_(open(buildout_script).read()) # doctest: +ELLIPSIS
#... #...
sys.path[0:0] = [ sys.path[0:0] = [
'/sample/eggs/setuptools-...egg',
'/sample/eggs/zc.buildout-2.0.0...egg', '/sample/eggs/zc.buildout-2.0.0...egg',
'/sample/eggs/setuptools-...egg'...
]... ]...
Now trying the ``--setuptools-version`` option, that lets you define a version Now trying the ``--setuptools-version`` option, that lets you define a version
...@@ -106,8 +106,8 @@ Let's make sure the generated ``buildout`` script uses it:: ...@@ -106,8 +106,8 @@ Let's make sure the generated ``buildout`` script uses it::
>>> print_(open(buildout_script).read()) # doctest: +ELLIPSIS >>> print_(open(buildout_script).read()) # doctest: +ELLIPSIS
#... #...
sys.path[0:0] = [ sys.path[0:0] = [
'/sample/eggs/setuptools-8.0...egg',
'/sample/eggs/zc.buildout-...egg', '/sample/eggs/zc.buildout-...egg',
'/sample/eggs/setuptools-8.0...egg'...
]... ]...
Now let's try specifying both ``zc.buildout`` and ``setuptools`` to versions Now let's try specifying both ``zc.buildout`` and ``setuptools`` to versions
...@@ -124,8 +124,8 @@ Let's make sure the generated ``buildout`` script uses it:: ...@@ -124,8 +124,8 @@ Let's make sure the generated ``buildout`` script uses it::
>>> print_(open(buildout_script).read()) # doctest: +ELLIPSIS >>> print_(open(buildout_script).read()) # doctest: +ELLIPSIS
#... #...
sys.path[0:0] = [ sys.path[0:0] = [
'/sample/eggs/setuptools-8.0...egg',
'/sample/eggs/zc.buildout-2.0.0...egg', '/sample/eggs/zc.buildout-2.0.0...egg',
'/sample/eggs/setuptools-8.0...egg'...
]... ]...
For a completely offline install we want to avoid downloading ``ez_setup.py``, For a completely offline install we want to avoid downloading ``ez_setup.py``,
...@@ -156,8 +156,8 @@ specify the setuptools version, and to reuse the setuptools zipfile:: ...@@ -156,8 +156,8 @@ specify the setuptools version, and to reuse the setuptools zipfile::
>>> print_(open(buildout_script).read()) # doctest: +ELLIPSIS >>> print_(open(buildout_script).read()) # doctest: +ELLIPSIS
#... #...
sys.path[0:0] = [ sys.path[0:0] = [
'/sample/eggs/setuptools-14.3...egg',
'/sample/eggs/zc.buildout-2.0.0...egg', '/sample/eggs/zc.buildout-2.0.0...egg',
'/sample/eggs/setuptools-14.3...egg'...
]... ]...
You can ask ``bootstrap.py`` for its version. This is really the day the last You can ask ``bootstrap.py`` for its version. This is really the day the last
......
...@@ -61,9 +61,6 @@ def print_(*args, **kw): ...@@ -61,9 +61,6 @@ def print_(*args, **kw):
realpath = zc.buildout.easy_install.realpath realpath = zc.buildout.easy_install.realpath
pkg_resources_loc = pkg_resources.working_set.find(
pkg_resources.Requirement.parse('setuptools')).location
_isurl = re.compile('([a-zA-Z0-9+.-]+)://').match _isurl = re.compile('([a-zA-Z0-9+.-]+)://').match
class MissingOption(zc.buildout.UserError, KeyError): class MissingOption(zc.buildout.UserError, KeyError):
...@@ -435,12 +432,10 @@ class Buildout(DictMixin): ...@@ -435,12 +432,10 @@ 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 = []
for name in 'setuptools', 'zc.buildout': for dist in zc.buildout.easy_install.buildout_and_setuptools_dists:
r = pkg_resources.Requirement.parse(name)
dist = pkg_resources.working_set.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(self['buildout']['develop-eggs-directory'],
name+'.egg-link') dist.key + '.egg-link')
open(dest, 'w').write(dist.location) open(dest, 'w').write(dist.location)
entries.append(dist.location) entries.append(dist.location)
else: else:
...@@ -752,7 +747,8 @@ class Buildout(DictMixin): ...@@ -752,7 +747,8 @@ class Buildout(DictMixin):
dest = self['buildout']['develop-eggs-directory'] dest = self['buildout']['develop-eggs-directory']
old_files = os.listdir(dest) old_files = os.listdir(dest)
env = dict(os.environ, PYTHONPATH=pkg_resources_loc) env = dict(os.environ,
PYTHONPATH=zc.buildout.easy_install.setuptools_pythonpath)
here = os.getcwd() here = os.getcwd()
try: try:
try: try:
...@@ -1090,7 +1086,6 @@ class Buildout(DictMixin): ...@@ -1090,7 +1086,6 @@ class Buildout(DictMixin):
fd, tsetup = tempfile.mkstemp() fd, tsetup = tempfile.mkstemp()
try: try:
os.write(fd, (zc.buildout.easy_install.runsetup_template % dict( os.write(fd, (zc.buildout.easy_install.runsetup_template % dict(
setuptools=pkg_resources_loc,
setupdir=os.path.dirname(setup), setupdir=os.path.dirname(setup),
setup=setup, setup=setup,
__file__ = setup, __file__ = setup,
......
...@@ -52,8 +52,12 @@ The ``bin`` directory contains scripts:: ...@@ -52,8 +52,12 @@ The ``bin`` directory contains scripts::
>>> ls(sample_buildout, 'bin') >>> ls(sample_buildout, 'bin')
- buildout - buildout
The ``eggs`` directory has installed distributions:
>>> ls(sample_buildout, 'eggs') >>> ls(sample_buildout, 'eggs')
d...
- setuptools-0.7-py3.3.egg - setuptools-0.7-py3.3.egg
...
- zc.buildout.egg-link - zc.buildout.egg-link
The ``develop-eggs`` and ``parts`` directories are initially empty:: The ``develop-eggs`` and ``parts`` directories are initially empty::
...@@ -1138,6 +1142,17 @@ relative to the ``myfiles`` section. ...@@ -1138,6 +1142,17 @@ relative to the ``myfiles`` section.
though ``<=`` may look like a new operator, it's still just the familiar though ``<=`` may look like a new operator, it's still just the familiar
``key = value`` syntax. ``key = value`` syntax.
.. cleanup buildout
>>> write(sample_buildout, 'buildout.cfg',
... """
... [buildout]
... develop = recipes
... parts =
... """)
>>> _ = system(buildout)
Extending sections (macros) - Adding and removing options Extending sections (macros) - Adding and removing options
--------------------------------------------------------- ---------------------------------------------------------
...@@ -1202,7 +1217,6 @@ Set up a buildout configuration for this extension. ...@@ -1202,7 +1217,6 @@ Set up a buildout configuration for this extension.
>>> os.chdir(sample_buildout) >>> os.chdir(sample_buildout)
>>> print_(system(os.path.join(sample_buildout, 'bin', 'buildout')), end='') # doctest: +ELLIPSIS >>> print_(system(os.path.join(sample_buildout, 'bin', 'buildout')), end='') # doctest: +ELLIPSIS
Develop: '/sample-buildout/demo' Develop: '/sample-buildout/demo'
....
Verify option values. Verify option values.
...@@ -2645,7 +2659,7 @@ database is shown:: ...@@ -2645,7 +2659,7 @@ database is shown::
We have a develop egg: zc.buildout 1.0.0. We have a develop egg: zc.buildout 1.0.0.
We have the best distribution that satisfies 'setuptools'. We have the best distribution that satisfies 'setuptools'.
Picked: setuptools = 0.7 Picked: setuptools = 0.7
<BLANKLINE> ...
Configuration data: Configuration data:
[buildout] [buildout]
allow-hosts = * allow-hosts = *
...@@ -2901,7 +2915,9 @@ We also get other buildout artifacts:: ...@@ -2901,7 +2915,9 @@ We also get other buildout artifacts::
>>> _ = (ls(sample_bootstrapped, 'eggs'), >>> _ = (ls(sample_bootstrapped, 'eggs'),
... ls(sample_bootstrapped, 'develop-eggs')) ... ls(sample_bootstrapped, 'develop-eggs'))
d...
- setuptools-0.7-py2.3.egg - setuptools-0.7-py2.3.egg
...
- zc.buildout-1.0-py2.3.egg - zc.buildout-1.0-py2.3.egg
(We list both the ``eggs`` and ``develop-eggs`` directories because the (We list both the ``eggs`` and ``develop-eggs`` directories because the
......
...@@ -59,7 +59,7 @@ If we run the buildout, we'll see the eggs installed from the link ...@@ -59,7 +59,7 @@ If we run the buildout, we'll see the eggs installed from the link
server as usual: server as usual:
>>> print_(system(buildout), end='') >>> print_(system(buildout), end='')
GET 200 / GET ...
GET 200 /demo-0.2-py2.4.egg GET 200 /demo-0.2-py2.4.egg
GET 200 /demoneeded-1.1.zip GET 200 /demoneeded-1.1.zip
Installing eggs. Installing eggs.
...@@ -89,7 +89,7 @@ If we remove the installed eggs from eggs directory and re-run the buildout: ...@@ -89,7 +89,7 @@ If we remove the installed eggs from eggs directory and re-run the buildout:
... remove('eggs', f) ... remove('eggs', f)
>>> print_(system(buildout), end='') >>> print_(system(buildout), end='')
GET 200 / GET ...
Updating eggs. Updating eggs.
Getting distribution for 'demo==0.2'. Getting distribution for 'demo==0.2'.
Got demo 0.2. Got demo 0.2.
......
...@@ -74,16 +74,11 @@ if has_distribute and not has_setuptools: ...@@ -74,16 +74,11 @@ if has_distribute and not has_setuptools:
" you have the latest version downloaded from" " you have the latest version downloaded from"
" https://bootstrap.pypa.io/bootstrap-buildout.py") " https://bootstrap.pypa.io/bootstrap-buildout.py")
setuptools_loc = pkg_resources.working_set.find( # Include buildout and setuptools eggs in paths. We get this
pkg_resources.Requirement.parse('setuptools') # initially from the entire working set. Later, we'll use the install
).location # function to narrow to just the buildout and setuptools paths.
buildout_and_setuptools_path = [d.location for d in pkg_resources.working_set]
# Include buildout and setuptools eggs in paths setuptools_path = buildout_and_setuptools_path
buildout_and_setuptools_path = [
setuptools_loc,
pkg_resources.working_set.find(
pkg_resources.Requirement.parse('zc.buildout')).location,
]
FILE_SCHEME = re.compile('file://', re.I).match FILE_SCHEME = re.compile('file://', re.I).match
DUNDER_FILE_PATTERN = re.compile(r"__file__ = '(?P<filename>.+)'$") DUNDER_FILE_PATTERN = re.compile(r"__file__ = '(?P<filename>.+)'$")
...@@ -208,7 +203,7 @@ class Installer: ...@@ -208,7 +203,7 @@ class Installer:
if use_dependency_links is not None: if use_dependency_links is not None:
self._use_dependency_links = use_dependency_links self._use_dependency_links = use_dependency_links
self._links = links = list(_fix_file_links(links)) self._links = links = list(self._fix_file_links(links))
if self._download_cache and (self._download_cache not in links): if self._download_cache and (self._download_cache not in links):
links.insert(0, self._download_cache) links.insert(0, self._download_cache)
...@@ -269,7 +264,7 @@ class Installer: ...@@ -269,7 +264,7 @@ class Installer:
if self._prefer_final: if self._prefer_final:
fdists = [dist for dist in dists fdists = [dist for dist in dists
if _final_version(dist.parsed_version) if self._final_version(dist.parsed_version)
] ]
if fdists: if fdists:
# There are final dists, so only use those # There are final dists, so only use those
...@@ -300,8 +295,8 @@ class Installer: ...@@ -300,8 +295,8 @@ class Installer:
return best_we_have, None return best_we_have, None
if self._prefer_final: if self._prefer_final:
if _final_version(best_available.parsed_version): if self._final_version(best_available.parsed_version):
if _final_version(best_we_have.parsed_version): if self._final_version(best_we_have.parsed_version):
if (best_we_have.parsed_version if (best_we_have.parsed_version
< <
best_available.parsed_version best_available.parsed_version
...@@ -310,7 +305,7 @@ class Installer: ...@@ -310,7 +305,7 @@ class Installer:
else: else:
return None, best_available return None, best_available
else: else:
if (not _final_version(best_we_have.parsed_version) if (not self._final_version(best_we_have.parsed_version)
and and
(best_we_have.parsed_version (best_we_have.parsed_version
< <
...@@ -339,10 +334,10 @@ class Installer: ...@@ -339,10 +334,10 @@ class Installer:
tmp = tempfile.mkdtemp(dir=dest) tmp = tempfile.mkdtemp(dir=dest)
try: try:
path = setuptools_loc path = setuptools_path
args = [sys.executable, '-c', args = [sys.executable, '-c',
('import sys; sys.path[0:0] = [%r]; ' % path) + ('import sys; sys.path[0:0] = %r; ' % path) +
_easy_install_cmd, '-mZUNxd', tmp] _easy_install_cmd, '-mZUNxd', tmp]
level = logger.getEffectiveLevel() level = logger.getEffectiveLevel()
if level > 0: if level > 0:
...@@ -428,7 +423,7 @@ class Installer: ...@@ -428,7 +423,7 @@ class Installer:
# result if it is non empty. # result if it is non empty.
if self._prefer_final: if self._prefer_final:
fdists = [dist for dist in dists fdists = [dist for dist in dists
if _final_version(dist.parsed_version) if self._final_version(dist.parsed_version)
] ]
if fdists: if fdists:
# There are final dists, so only use those # There are final dists, so only use those
...@@ -688,7 +683,7 @@ class Installer: ...@@ -688,7 +683,7 @@ class Installer:
logger.debug('Getting required %r', str(req)) logger.debug('Getting required %r', str(req))
else: else:
logger.debug('Adding required %r', str(req)) logger.debug('Adding required %r', str(req))
_log_requirement(ws, req) self._log_requirement(ws, req)
for dist in self._get_dist(req, ws, for dist in self._get_dist(req, ws,
for_buildout_run=for_buildout_run): for_buildout_run=for_buildout_run):
ws.add(dist) ws.add(dist)
...@@ -703,7 +698,8 @@ class Installer: ...@@ -703,7 +698,8 @@ class Installer:
extra_requirements = dist.requires(req.extras)[::-1] extra_requirements = dist.requires(req.extras)[::-1]
for extra_requirement in extra_requirements: for extra_requirement in extra_requirements:
self._requirements_and_constraints.append( self._requirements_and_constraints.append(
"Requirement of %s: %s" % (current_requirement, extra_requirement)) "Requirement of %s: %s" % (
current_requirement, extra_requirement))
requirements.extend(extra_requirements) requirements.extend(extra_requirements)
processed[req] = True processed[req] = True
...@@ -779,6 +775,38 @@ class Installer: ...@@ -779,6 +775,38 @@ class Installer:
if tmp != self._download_cache: if tmp != self._download_cache:
shutil.rmtree(tmp) shutil.rmtree(tmp)
def _fix_file_links(self, links):
for link in links:
if link.startswith('file://') and link[-1] != '/':
if os.path.isdir(link[7:]):
# work around excessive restriction in setuptools:
link += '/'
yield link
def _log_requirement(self, ws, req):
if (not logger.isEnabledFor(logging.DEBUG) and
not Installer._store_required_by):
# Sorting the working set and iterating over it's requirements
# is expensive, so short circuit the work if it won't even be
# logged. When profiling a simple buildout with 10 parts with
# identical and large working sets, this resulted in a
# decrease of run time from 93.411 to 15.068 seconds, about a
# 6 fold improvement.
return
ws = list(ws)
ws.sort()
for dist in ws:
if req in dist.requires():
logger.debug(" required by %s." % dist)
req_ = str(req)
if req_ not in Installer._required_by:
Installer._required_by[req_] = set()
Installer._required_by[req_].add(str(dist.as_requirement()))
def _final_version(self, parsed_version):
return not parsed_version.is_prerelease
def normalize_versions(versions): def normalize_versions(versions):
"""Return version dict with keys normalized to lowercase. """Return version dict with keys normalized to lowercase.
...@@ -858,6 +886,12 @@ def install(specs, dest, ...@@ -858,6 +886,12 @@ def install(specs, dest,
allow_hosts=allow_hosts) allow_hosts=allow_hosts)
return installer.install(specs, working_set) return installer.install(specs, working_set)
buildout_and_setuptools_dists = list(install(['zc.buildout'], None))
buildout_and_setuptools_path = [d.location
for d in buildout_and_setuptools_dists]
setuptools_path = [d.location
for d in install(['setuptools'], None)]
setuptools_pythonpath = os.pathsep.join(setuptools_path)
def build(spec, dest, build_ext, def build(spec, dest, build_ext,
links=(), index=None, links=(), index=None,
...@@ -973,7 +1007,6 @@ def develop(setup, dest, ...@@ -973,7 +1007,6 @@ def develop(setup, dest,
undo.append(lambda: os.close(fd)) undo.append(lambda: os.close(fd))
os.write(fd, (runsetup_template % dict( os.write(fd, (runsetup_template % dict(
setuptools=setuptools_loc,
setupdir=directory, setupdir=directory,
setup=setup, setup=setup,
__file__ = setup, __file__ = setup,
...@@ -1016,6 +1049,7 @@ def working_set(specs, executable, path=None, ...@@ -1016,6 +1049,7 @@ def working_set(specs, executable, path=None,
return install(specs, None, path=path) return install(specs, None, path=path)
def scripts(reqs, working_set, executable, dest=None, def scripts(reqs, working_set, executable, dest=None,
scripts=None, scripts=None,
extra_paths=(), extra_paths=(),
...@@ -1396,19 +1430,19 @@ if _interactive: ...@@ -1396,19 +1430,19 @@ if _interactive:
runsetup_template = """ runsetup_template = """
import sys import sys
sys.path.insert(0, %(setupdir)r) sys.path.insert(0, %%(setupdir)r)
sys.path.insert(0, %(setuptools)r) sys.path[0:0] = %r
import os, setuptools import os, setuptools
__file__ = %(__file__)r __file__ = %%(__file__)r
os.chdir(%(setupdir)r) os.chdir(%%(setupdir)r)
sys.argv[0] = %(setup)r sys.argv[0] = %%(setup)r
with open(%(setup)r, 'U') as f: with open(%%(setup)r, 'U') as f:
exec(compile(f.read(), %(setup)r, 'exec')) exec(compile(f.read(), %%(setup)r, 'exec'))
""" """ % setuptools_path
class VersionConflict(zc.buildout.UserError): class VersionConflict(zc.buildout.UserError):
...@@ -1443,38 +1477,6 @@ class MissingDistribution(zc.buildout.UserError): ...@@ -1443,38 +1477,6 @@ class MissingDistribution(zc.buildout.UserError):
req, ws = self.data req, ws = self.data
return "Couldn't find a distribution for %r." % str(req) return "Couldn't find a distribution for %r." % str(req)
def _log_requirement(ws, req):
if (not logger.isEnabledFor(logging.DEBUG) and
not Installer._store_required_by):
# Sorting the working set and iterating over it's requirements
# is expensive, so short circuit the work if it won't even be
# logged. When profiling a simple buildout with 10 parts with
# identical and large working sets, this resulted in a
# decrease of run time from 93.411 to 15.068 seconds, about a
# 6 fold improvement.
return
ws = list(ws)
ws.sort()
for dist in ws:
if req in dist.requires():
logger.debug(" required by %s." % dist)
req_ = str(req)
if req_ not in Installer._required_by:
Installer._required_by[req_] = set()
Installer._required_by[req_].add(str(dist.as_requirement()))
def _fix_file_links(links):
for link in links:
if link.startswith('file://') and link[-1] != '/':
if os.path.isdir(link[7:]):
# work around excessive restriction in setuptools:
link += '/'
yield link
def _final_version(parsed_version):
return not parsed_version.is_prerelease
def redo_pyc(egg): def redo_pyc(egg):
if not os.path.isdir(egg): if not os.path.isdir(egg):
return return
......
...@@ -131,6 +131,7 @@ specifying a versions section: ...@@ -131,6 +131,7 @@ specifying a versions section:
We have a develop egg: zc.buildout 1.0.0. We have a develop egg: zc.buildout 1.0.0.
We have the best distribution that satisfies 'setuptools'. We have the best distribution that satisfies 'setuptools'.
Picked: setuptools = 0.6 Picked: setuptools = 0.6
...
Installing 'spam'. Installing 'spam'.
We have the best distribution that satisfies 'spam'. We have the best distribution that satisfies 'spam'.
Picked: spam = 2. Picked: spam = 2.
...@@ -153,6 +154,7 @@ If we run the buildout with the versions section: ...@@ -153,6 +154,7 @@ If we run the buildout with the versions section:
We have a develop egg: zc.buildout 1.0.0. We have a develop egg: zc.buildout 1.0.0.
We have the best distribution that satisfies 'setuptools'. We have the best distribution that satisfies 'setuptools'.
Picked: setuptools = 0.6 Picked: setuptools = 0.6
...
Installing 'spam'. Installing 'spam'.
We have the distribution that satisfies 'spam==1'. We have the distribution that satisfies 'spam==1'.
Uninstalling foo. Uninstalling foo.
...@@ -184,6 +186,7 @@ versions for. ...@@ -184,6 +186,7 @@ versions for.
We have a develop egg: zc.buildout 1.0.0. We have a develop egg: zc.buildout 1.0.0.
We have the best distribution that satisfies 'setuptools'. We have the best distribution that satisfies 'setuptools'.
Picked: setuptools = 0.6 Picked: setuptools = 0.6
...
Installing 'spam >0'. Installing 'spam >0'.
We have the distribution that satisfies 'spam==1'. We have the distribution that satisfies 'spam==1'.
Uninstalling foo. Uninstalling foo.
...@@ -293,8 +296,11 @@ versions it picked at the end of its run: ...@@ -293,8 +296,11 @@ versions it picked at the end of its run:
Versions had to be automatically picked. Versions had to be automatically picked.
The following part definition lists the versions picked: The following part definition lists the versions picked:
[versions] [versions]
...
setuptools = 0.6.99 setuptools = 0.6.99
...
spam = 2 spam = 2
...
When everything is pinned, no output is generated: When everything is pinned, no output is generated:
...@@ -315,6 +321,7 @@ When everything is pinned, no output is generated: ...@@ -315,6 +321,7 @@ When everything is pinned, no output is generated:
>>> print_(system(buildout), end='') # doctest: +ELLIPSIS >>> print_(system(buildout), end='') # doctest: +ELLIPSIS
Updating foo. Updating foo.
recipe v2 recipe v2
...
The Python package index is case-insensitive. Both The Python package index is case-insensitive. Both
http://pypi.python.org/simple/Django/ and http://pypi.python.org/simple/Django/ and
...@@ -339,6 +346,7 @@ and case differences won't impact the pinning: ...@@ -339,6 +346,7 @@ and case differences won't impact the pinning:
>>> print_(system(buildout), end='') # doctest: +ELLIPSIS >>> print_(system(buildout), end='') # doctest: +ELLIPSIS
Updating foo. Updating foo.
recipe v2 recipe v2
...
Sometimes it is handy to have a separate file with versions. This is a regular Sometimes it is handy to have a separate file with versions. This is a regular
buildout file with a single ``[versions]`` section. You include it by buildout file with a single ``[versions]`` section. You include it by
...@@ -364,6 +372,7 @@ extending from that versions file: ...@@ -364,6 +372,7 @@ extending from that versions file:
>>> print_(system(buildout), end='') # doctest: +ELLIPSIS >>> print_(system(buildout), end='') # doctest: +ELLIPSIS
Updating foo. Updating foo.
recipe v2 recipe v2
...
If not everything is pinned and buildout has to pick versions, you can tell If not everything is pinned and buildout has to pick versions, you can tell
buildout to append the versions to your versions file. It simply appends them buildout to append the versions to your versions file. It simply appends them
...@@ -392,7 +401,9 @@ at the end. ...@@ -392,7 +401,9 @@ at the end.
Versions had to be automatically picked. Versions had to be automatically picked.
The following part definition lists the versions picked: The following part definition lists the versions picked:
[versions] [versions]
...
spam = 2 spam = 2
...
Picked versions have been written to my_versions.cfg Picked versions have been written to my_versions.cfg
The versions file now contains the extra pin: The versions file now contains the extra pin:
...@@ -402,14 +413,17 @@ The versions file now contains the extra pin: ...@@ -402,14 +413,17 @@ The versions file now contains the extra pin:
... ...
<BLANKLINE> <BLANKLINE>
# Added by buildout at YYYY-MM-DD hh:mm:ss.dddddd # Added by buildout at YYYY-MM-DD hh:mm:ss.dddddd
...
spam = 2 spam = 2
<BLANKLINE> <BLANKLINE>
...
And re-running buildout doesn't report any picked versions anymore: And re-running buildout doesn't report any picked versions anymore:
>>> print_(system(buildout), end='') # doctest: +ELLIPSIS >>> print_(system(buildout), end='') # doctest: +ELLIPSIS
Updating foo. Updating foo.
recipe v2 recipe v2
...
If you've enabled ``update-versions-file`` but not ``show-picked-versions``, If you've enabled ``update-versions-file`` but not ``show-picked-versions``,
buildout will append the versions to your versions file anyway (without buildout will append the versions to your versions file anyway (without
...@@ -444,8 +458,10 @@ The versions file contains the extra pin: ...@@ -444,8 +458,10 @@ The versions file contains the extra pin:
... ...
<BLANKLINE> <BLANKLINE>
# Added by buildout at YYYY-MM-DD hh:mm:ss.dddddd # Added by buildout at YYYY-MM-DD hh:mm:ss.dddddd
...
spam = 2 spam = 2
<BLANKLINE> <BLANKLINE>
...
Because buildout now includes buildout-versions' (and part of the older Because buildout now includes buildout-versions' (and part of the older
buildout.dumppickedversions') functionality, it warns if these extensions are buildout.dumppickedversions') functionality, it warns if these extensions are
......
...@@ -46,9 +46,6 @@ print_ = zc.buildout.buildout.print_ ...@@ -46,9 +46,6 @@ print_ = zc.buildout.buildout.print_
fsync = getattr(os, 'fsync', lambda fileno: None) fsync = getattr(os, 'fsync', lambda fileno: None)
is_win32 = sys.platform == 'win32' is_win32 = sys.platform == 'win32'
setuptools_location = pkg_resources.working_set.find(
pkg_resources.Requirement.parse('setuptools')).location
def cat(dir, *names): def cat(dir, *names):
path = os.path.join(dir, *names) path = os.path.join(dir, *names)
if (not os.path.exists(path) if (not os.path.exists(path)
...@@ -149,7 +146,10 @@ def _runsetup(setup, *args): ...@@ -149,7 +146,10 @@ def _runsetup(setup, *args):
os.chdir(os.path.dirname(setup)) os.chdir(os.path.dirname(setup))
zc.buildout.easy_install.call_subprocess( zc.buildout.easy_install.call_subprocess(
[sys.executable, setup] + args, [sys.executable, setup] + args,
env=dict(os.environ, PYTHONPATH=setuptools_location)) env=dict(os.environ,
PYTHONPATH=zc.buildout.easy_install.setuptools_pythonpath,
),
)
if os.path.exists('build'): if os.path.exists('build'):
rmtree('build') rmtree('build')
finally: finally:
......
...@@ -341,6 +341,7 @@ If we use the verbose switch, we can see where requirements are coming from: ...@@ -341,6 +341,7 @@ If we use the verbose switch, we can see where requirements are coming from:
We have a develop egg: zc.buildout 1.0.0 We have a develop egg: zc.buildout 1.0.0
We have the best distribution that satisfies 'setuptools'. We have the best distribution that satisfies 'setuptools'.
Picked: setuptools = 0.7 Picked: setuptools = 0.7
...
Develop: '/sample-buildout/sampley' Develop: '/sample-buildout/sampley'
Develop: '/sample-buildout/samplez' Develop: '/sample-buildout/samplez'
Develop: '/sample-buildout/samplea' Develop: '/sample-buildout/samplea'
...@@ -464,6 +465,7 @@ We do not need to run in verbose mode for that to work: ...@@ -464,6 +465,7 @@ We do not need to run in verbose mode for that to work:
Versions had to be automatically picked. Versions had to be automatically picked.
The following part definition lists the versions picked: The following part definition lists the versions picked:
[versions] [versions]
...
<BLANKLINE> <BLANKLINE>
# Required by: # Required by:
# sampley==1 # sampley==1
...@@ -847,7 +849,9 @@ On the other hand, if we have a regular egg, rather than a develop egg: ...@@ -847,7 +849,9 @@ On the other hand, if we have a regular egg, rather than a develop egg:
- zc.recipe.egg.egg-link - zc.recipe.egg.egg-link
>>> ls('eggs') # doctest: +ELLIPSIS >>> ls('eggs') # doctest: +ELLIPSIS
d...
- foox-0.0.0-py2.4.egg - foox-0.0.0-py2.4.egg
...
d setuptools.eggpyN.N.egg d setuptools.eggpyN.N.egg
... ...
...@@ -1747,6 +1751,7 @@ def install_source_dist_with_bad_py(): ...@@ -1747,6 +1751,7 @@ def install_source_dist_with_bad_py():
... ...
>>> ls('eggs') # doctest: +ELLIPSIS >>> ls('eggs') # doctest: +ELLIPSIS
d...
d badegg-1-py2.4.egg d badegg-1-py2.4.egg
... ...
...@@ -2042,6 +2047,7 @@ def dealing_with_extremely_insane_dependencies(): ...@@ -2042,6 +2047,7 @@ def dealing_with_extremely_insane_dependencies():
We have a develop egg: zc.buildout 1.0.0 We have a develop egg: zc.buildout 1.0.0
We have the best distribution that satisfies 'setuptools'. We have the best distribution that satisfies 'setuptools'.
Picked: setuptools = 0.7 Picked: setuptools = 0.7
...
Develop: '/sample-buildout/pack0' Develop: '/sample-buildout/pack0'
Develop: '/sample-buildout/pack1' Develop: '/sample-buildout/pack1'
Develop: '/sample-buildout/pack2' Develop: '/sample-buildout/pack2'
...@@ -2469,7 +2475,7 @@ Distribution setup scripts can import modules in the distribution directory: ...@@ -2469,7 +2475,7 @@ Distribution setup scripts can import modules in the distribution directory:
""" """
def dont_pick_setuptools_if_version_is_specified_when_required_by_src_dist(): def dont_pick_setuptools_if_version_is_specified_when_required_by_src_dist():
""" r"""
When installing a source distribution, we got setuptools without When installing a source distribution, we got setuptools without
honoring our version specification. honoring our version specification.
...@@ -2491,14 +2497,15 @@ honoring our version specification. ...@@ -2491,14 +2497,15 @@ honoring our version specification.
... allow-picked-versions = false ... allow-picked-versions = false
... ...
... [versions] ... [versions]
... setuptools = %s ... wtf = %s
... foo = 1 ... foo = 1
... ...
... [foo] ... [foo]
... recipe = zc.recipe.egg ... recipe = zc.recipe.egg
... eggs = foo ... eggs = foo
... ''' % pkg_resources.working_set.find( ... ''' % ('\n'.join(
... pkg_resources.Requirement.parse('setuptools')).version) ... '%s = %s' % (d.key, d.version)
... for d in zc.buildout.easy_install.buildout_and_setuptools_dists)))
>>> print_(system(buildout), end='') >>> print_(system(buildout), end='')
Installing foo. Installing foo.
...@@ -2867,7 +2874,7 @@ def want_new_zcrecipeegg(): ...@@ -2867,7 +2874,7 @@ def want_new_zcrecipeegg():
... eggs = demo ... eggs = demo
... ''') ... ''')
>>> print_(system(join('bin', 'buildout')), end='') # doctest: +ELLIPSIS >>> print_(system(join('bin', 'buildout')), end='') # doctest: +ELLIPSIS
Getting distribution for 'zc.recipe.egg<2dev,>=2.0.0a3'. Getting distribution for 'zc.recipe.egg<2dev,>=2.0.0a3'...
While: While:
Installing. Installing.
Getting section egg. Getting section egg.
...@@ -2932,6 +2939,7 @@ def bootstrap_honors_relative_paths(): ...@@ -2932,6 +2939,7 @@ def bootstrap_honors_relative_paths():
<BLANKLINE> <BLANKLINE>
import sys import sys
sys.path[0:0] = [ sys.path[0:0] = [
...
join(base, 'eggs/setuptools-0.7-py2.7.egg'), join(base, 'eggs/setuptools-0.7-py2.7.egg'),
... ...
] ]
...@@ -3273,9 +3281,7 @@ def getWorkingSetWithBuildoutEgg(test): ...@@ -3273,9 +3281,7 @@ def getWorkingSetWithBuildoutEgg(test):
os.path.join(os.path.dirname(dist.location), 'setup.py'), os.path.join(os.path.dirname(dist.location), 'setup.py'),
'-q', 'bdist_egg', '-d', eggs], '-q', 'bdist_egg', '-d', eggs],
env=dict(os.environ, env=dict(os.environ,
PYTHONPATH=pkg_resources.working_set.find( PYTHONPATH=zc.buildout.easy_install.setuptools_pythonpath,
pkg_resources.Requirement.parse('setuptools')
).location,
), ),
) )
os.chdir(here) os.chdir(here)
...@@ -3297,10 +3303,9 @@ def updateSetup(test): ...@@ -3297,10 +3303,9 @@ def updateSetup(test):
test.globs['new_releases'] = new_releases test.globs['new_releases'] = new_releases
ws = getWorkingSetWithBuildoutEgg(test) ws = getWorkingSetWithBuildoutEgg(test)
# now let's make the new releases # now let's make the new releases
makeNewRelease('zc.buildout', ws, new_releases) for dist in zc.buildout.easy_install.buildout_and_setuptools_dists:
os.mkdir(os.path.join(new_releases, 'zc.buildout')) makeNewRelease(dist.key, ws, new_releases)
makeNewRelease('setuptools', ws, new_releases) os.mkdir(os.path.join(new_releases, dist.key))
os.mkdir(os.path.join(new_releases, 'setuptools'))
bootstrap_py = os.path.join( bootstrap_py = os.path.join(
os.path.dirname(os.path.dirname(os.path.dirname( os.path.dirname(os.path.dirname(os.path.dirname(
...@@ -3336,6 +3341,7 @@ def test_suite(): ...@@ -3336,6 +3341,7 @@ def test_suite():
'configparser.test'), 'configparser.test'),
manuel.testing.TestSuite( manuel.testing.TestSuite(
manuel.doctest.Manuel( manuel.doctest.Manuel(
optionflags=doctest.NORMALIZE_WHITESPACE | doctest.ELLIPSIS,
checker=renormalizing.RENormalizing([ checker=renormalizing.RENormalizing([
zc.buildout.testing.normalize_path, zc.buildout.testing.normalize_path,
zc.buildout.testing.normalize_endings, zc.buildout.testing.normalize_endings,
...@@ -3378,6 +3384,7 @@ def test_suite(): ...@@ -3378,6 +3384,7 @@ def test_suite():
'runsetup.txt', 'repeatable.txt', 'setup.txt', 'runsetup.txt', 'repeatable.txt', 'setup.txt',
setUp=zc.buildout.testing.buildoutSetUp, setUp=zc.buildout.testing.buildoutSetUp,
tearDown=zc.buildout.testing.buildoutTearDown, tearDown=zc.buildout.testing.buildoutTearDown,
optionflags=doctest.NORMALIZE_WHITESPACE | doctest.ELLIPSIS,
checker=renormalizing.RENormalizing([ checker=renormalizing.RENormalizing([
zc.buildout.testing.normalize_path, zc.buildout.testing.normalize_path,
zc.buildout.testing.normalize_endings, zc.buildout.testing.normalize_endings,
...@@ -3434,6 +3441,7 @@ def test_suite(): ...@@ -3434,6 +3441,7 @@ def test_suite():
'update.txt', 'update.txt',
setUp=updateSetup, setUp=updateSetup,
tearDown=zc.buildout.testing.buildoutTearDown, tearDown=zc.buildout.testing.buildoutTearDown,
optionflags=doctest.NORMALIZE_WHITESPACE | doctest.ELLIPSIS,
checker=renormalizing.RENormalizing([ checker=renormalizing.RENormalizing([
(re.compile(r'(zc.buildout|setuptools)-\d+[.]\d+\S*' (re.compile(r'(zc.buildout|setuptools)-\d+[.]\d+\S*'
'-py\d.\d.egg'), '-py\d.\d.egg'),
...@@ -3463,6 +3471,7 @@ def test_suite(): ...@@ -3463,6 +3471,7 @@ def test_suite():
'allowhosts.txt', 'allowhosts.txt',
setUp=easy_install_SetUp, setUp=easy_install_SetUp,
tearDown=zc.buildout.testing.buildoutTearDown, tearDown=zc.buildout.testing.buildoutTearDown,
optionflags=doctest.NORMALIZE_WHITESPACE | doctest.ELLIPSIS,
checker=renormalizing.RENormalizing([ checker=renormalizing.RENormalizing([
zc.buildout.testing.normalize_script, zc.buildout.testing.normalize_script,
zc.buildout.testing.normalize_path, zc.buildout.testing.normalize_path,
......
...@@ -7,8 +7,10 @@ demonstrate this, we've created some "new releases" of buildout and ...@@ -7,8 +7,10 @@ demonstrate this, we've created some "new releases" of buildout and
setuptools in a new_releases folder: setuptools in a new_releases folder:
>>> ls(new_releases) >>> ls(new_releases)
d...
d setuptools d setuptools
- setuptools-99.99-py2.4.egg - setuptools-99.99-py2.4.egg
...
d zc.buildout d zc.buildout
- zc.buildout-99.99-py2.4.egg - zc.buildout-99.99-py2.4.egg
...@@ -70,6 +72,7 @@ new versions found in new releases: ...@@ -70,6 +72,7 @@ new versions found in new releases:
Got zc.buildout 99.99. Got zc.buildout 99.99.
Getting distribution for 'setuptools'. Getting distribution for 'setuptools'.
Got setuptools 99.99. Got setuptools 99.99.
...
Upgraded: Upgraded:
zc.buildout version 99.99, zc.buildout version 99.99,
setuptools version 99.99; setuptools version 99.99;
...@@ -89,6 +92,7 @@ Our buildout script has been updated to use the new eggs: ...@@ -89,6 +92,7 @@ Our buildout script has been updated to use the new eggs:
sys.path[0:0] = [ sys.path[0:0] = [
'/sample-buildout/eggs/zc.buildout-99.99-py2.4.egg', '/sample-buildout/eggs/zc.buildout-99.99-py2.4.egg',
'/sample-buildout/eggs/setuptools-99.99-py2.4.egg', '/sample-buildout/eggs/setuptools-99.99-py2.4.egg',
...
] ]
<BLANKLINE> <BLANKLINE>
import zc.buildout.buildout import zc.buildout.buildout
...@@ -228,6 +232,7 @@ directory: ...@@ -228,6 +232,7 @@ directory:
sys.path[0:0] = [ sys.path[0:0] = [
join(base, 'eggs/zc.buildout-99.99-py3.3.egg'), join(base, 'eggs/zc.buildout-99.99-py3.3.egg'),
join(base, 'eggs/setuptools-99.99-py3.3.egg'), join(base, 'eggs/setuptools-99.99-py3.3.egg'),
...
] ]
<BLANKLINE> <BLANKLINE>
import zc.buildout.buildout import zc.buildout.buildout
......
...@@ -72,9 +72,12 @@ Let's run the buildout: ...@@ -72,9 +72,12 @@ Let's run the buildout:
Now, if we look at the buildout eggs directory: Now, if we look at the buildout eggs directory:
>>> ls(sample_buildout, 'eggs') >>> ls(sample_buildout, 'eggs')
d...
d demo-0.2-py2.3.egg d demo-0.2-py2.3.egg
d demoneeded-1.1-py2.3.egg d demoneeded-1.1-py2.3.egg
...
- setuptools-0.7-py2.3.egg - setuptools-0.7-py2.3.egg
...
d zc.buildout-1.0-py2.3.egg d zc.buildout-1.0-py2.3.egg
We see that we got an egg for demo that met the requirement, as well We see that we got an egg for demo that met the requirement, as well
...@@ -261,9 +264,12 @@ We'll also run the buildout in off-line mode: ...@@ -261,9 +264,12 @@ We'll also run the buildout in off-line mode:
We didn't get an update for demo: We didn't get an update for demo:
>>> ls(sample_buildout, 'eggs') >>> ls(sample_buildout, 'eggs')
d...
d demo-0.2-py2.3.egg d demo-0.2-py2.3.egg
d demoneeded-1.1-py2.3.egg d demoneeded-1.1-py2.3.egg
...
- setuptools-0.7-py2.3.egg - setuptools-0.7-py2.3.egg
...
d zc.buildout-1.0-py2.3.egg d zc.buildout-1.0-py2.3.egg
If we run the buildout on the default online and newest modes, If we run the buildout on the default online and newest modes,
...@@ -278,10 +284,13 @@ we'll get an update for demo: ...@@ -278,10 +284,13 @@ we'll get an update for demo:
Then we'll get a new demo egg: Then we'll get a new demo egg:
>>> ls(sample_buildout, 'eggs') >>> ls(sample_buildout, 'eggs')
d...
d demo-0.2-py2.3.egg d demo-0.2-py2.3.egg
d demo-0.3-py2.3.egg d demo-0.3-py2.3.egg
d demoneeded-1.1-py2.3.egg d demoneeded-1.1-py2.3.egg
...
- setuptools-0.7-py2.4.egg - setuptools-0.7-py2.4.egg
...
d zc.buildout-1.0-py2.4.egg d zc.buildout-1.0-py2.4.egg
The script is updated too: The script is updated too:
......
...@@ -104,10 +104,7 @@ computed by the egg recipe by looking at .installed.cfg: ...@@ -104,10 +104,7 @@ computed by the egg recipe by looking at .installed.cfg:
<BLANKLINE> <BLANKLINE>
[sample-part] [sample-part]
__buildout_installed__ = __buildout_installed__ =
__buildout_signature__ = sample-6aWMvV2EJ9Ijq+bR8ugArQ== __buildout_signature__ = ...
zc.recipe.egg-cAsnudgkduAa/Fd+WJIM6Q==
setuptools-0.7-py2.4.egg
zc.buildout-+rYeCcmFuD1K/aB77XTj5A==
_b = /sample-buildout/bin _b = /sample-buildout/bin
_d = /sample-buildout/develop-eggs _d = /sample-buildout/develop-eggs
_e = /sample-buildout/eggs _e = /sample-buildout/eggs
......
...@@ -192,7 +192,7 @@ Let's define a script that uses out ext demo: ...@@ -192,7 +192,7 @@ Let's define a script that uses out ext demo:
Develop: '/sample-buildout/demo' Develop: '/sample-buildout/demo'
Updating extdemo. Updating extdemo.
Installing demo. Installing demo.
Generated script '/sample-buildout/bin/demo'. Generated script '/sample-buildout/bin/demo'...
When we run the script, we'll 42 printed: When we run the script, we'll 42 printed:
......
...@@ -41,6 +41,7 @@ def test_suite(): ...@@ -41,6 +41,7 @@ def test_suite():
doctest.DocFileSuite( doctest.DocFileSuite(
'README.rst', 'README.rst',
setUp=setUp, tearDown=zc.buildout.testing.buildoutTearDown, setUp=setUp, tearDown=zc.buildout.testing.buildoutTearDown,
optionflags=doctest.NORMALIZE_WHITESPACE | doctest.ELLIPSIS,
checker=renormalizing.RENormalizing([ checker=renormalizing.RENormalizing([
zc.buildout.testing.normalize_path, zc.buildout.testing.normalize_path,
zc.buildout.testing.normalize_endings, zc.buildout.testing.normalize_endings,
...@@ -59,6 +60,7 @@ def test_suite(): ...@@ -59,6 +60,7 @@ def test_suite():
doctest.DocFileSuite( doctest.DocFileSuite(
'api.rst', 'api.rst',
setUp=setUp, tearDown=zc.buildout.testing.buildoutTearDown, setUp=setUp, tearDown=zc.buildout.testing.buildoutTearDown,
optionflags=doctest.NORMALIZE_WHITESPACE | doctest.ELLIPSIS,
checker=renormalizing.RENormalizing([ checker=renormalizing.RENormalizing([
zc.buildout.testing.normalize_path, zc.buildout.testing.normalize_path,
zc.buildout.testing.normalize_endings, zc.buildout.testing.normalize_endings,
...@@ -79,6 +81,7 @@ def test_suite(): ...@@ -79,6 +81,7 @@ def test_suite():
doctest.DocFileSuite( doctest.DocFileSuite(
'custom.rst', 'custom.rst',
setUp=setUp, tearDown=zc.buildout.testing.buildoutTearDown, setUp=setUp, tearDown=zc.buildout.testing.buildoutTearDown,
optionflags=doctest.NORMALIZE_WHITESPACE | doctest.ELLIPSIS,
checker=renormalizing.RENormalizing([ checker=renormalizing.RENormalizing([
zc.buildout.testing.normalize_path, zc.buildout.testing.normalize_path,
zc.buildout.testing.normalize_endings, zc.buildout.testing.normalize_endings,
......
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