Commit 65cb7826 authored by Gary Poster's avatar Gary Poster

the "aspirin" release.

parent 70f63c8e
...@@ -2,6 +2,11 @@ ...@@ -2,6 +2,11 @@
Buildout Buildout
******** ********
*Note*: the 1.4.4 release is a release for people who encounter trouble
with the 1.5 line. By switching to `the associated bootstrap script
<http://svn.zope.org/repos/main/zc.buildout/branches/1.4/bootstrap/bootstrap.py>`_
you can stay on 1.4.4 until you are ready to migrate.
.. contents:: .. contents::
The Buildout project provides support for creating applications, The Buildout project provides support for creating applications,
......
...@@ -28,9 +28,14 @@ tmpeggs = tempfile.mkdtemp() ...@@ -28,9 +28,14 @@ tmpeggs = tempfile.mkdtemp()
is_jython = sys.platform.startswith('java') is_jython = sys.platform.startswith('java')
# parsing arguments # parsing arguments
parser = OptionParser() parser = OptionParser(
parser.add_option("-v", "--version", dest="version", 'This is a custom version of the zc.buildout %prog script. It is '
help="use a specific zc.buildout version") 'intended to meet a temporary need if you encounter problems with '
'the zc.buildout 1.5 release.')
parser.add_option("-v", "--version", dest="version", default='1.4.4',
help='Use a specific zc.buildout version. *This '
'bootstrap script defaults to '
'1.4.4, unlike usual buildpout bootstrap scripts.*')
parser.add_option("-d", "--distribute", parser.add_option("-d", "--distribute",
action="store_true", dest="distribute", default=False, action="store_true", dest="distribute", default=False,
help="Use Disribute rather than Setuptools.") help="Use Disribute rather than Setuptools.")
...@@ -85,7 +90,6 @@ else: ...@@ -85,7 +90,6 @@ else:
def quote (c): def quote (c):
return c return c
cmd = 'from setuptools.command.easy_install import main; main()'
ws = pkg_resources.working_set ws = pkg_resources.working_set
if USE_DISTRIBUTE: if USE_DISTRIBUTE:
...@@ -93,26 +97,28 @@ if USE_DISTRIBUTE: ...@@ -93,26 +97,28 @@ if USE_DISTRIBUTE:
else: else:
requirement = 'setuptools' requirement = 'setuptools'
if is_jython: env = dict(os.environ,
import subprocess
assert subprocess.Popen([sys.executable] + ['-c', quote(cmd), '-mqNxd',
quote(tmpeggs), 'zc.buildout' + VERSION],
env=dict(os.environ,
PYTHONPATH= PYTHONPATH=
ws.find(pkg_resources.Requirement.parse(requirement)).location ws.find(pkg_resources.Requirement.parse(requirement)).location
), )
).wait() == 0
else: cmd = [quote(sys.executable),
assert os.spawnle( '-c',
os.P_WAIT, sys.executable, quote (sys.executable), quote('from setuptools.command.easy_install import main; main()'),
'-c', quote (cmd), '-mqNxd', quote (tmpeggs), 'zc.buildout' + VERSION, '-mqNxd',
dict(os.environ, quote(tmpeggs)]
PYTHONPATH=
ws.find(pkg_resources.Requirement.parse(requirement)).location if 'bootstrap-testing-find-links' in os.environ:
), cmd.extend(['-f', os.environ['bootstrap-testing-find-links']])
) == 0
cmd.append('zc.buildout' + VERSION)
if is_jython:
import subprocess
exitcode = subprocess.Popen(cmd, env=env).wait()
else: # Windows prefers this, apparently; otherwise we would prefer subprocess
exitcode = os.spawnle(*([os.P_WAIT, sys.executable] + cmd + [env]))
assert exitcode == 0
ws.add_entry(tmpeggs) ws.add_entry(tmpeggs)
ws.require('zc.buildout' + VERSION) ws.require('zc.buildout' + VERSION)
......
...@@ -11,14 +11,14 @@ interpreter = py ...@@ -11,14 +11,14 @@ interpreter = py
[test] [test]
recipe = zc.recipe.testrunner recipe = zc.recipe.testrunner
eggs = eggs =
zc.buildout zc.buildout[test]
zc.recipe.egg zc.recipe.egg
# Tests that can be run wo a network # Tests that can be run wo a network
[oltest] [oltest]
recipe = zc.recipe.testrunner recipe = zc.recipe.testrunner
eggs = eggs =
zc.buildout zc.buildout[test]
zc.recipe.egg zc.recipe.egg
defaults = defaults =
[ [
......
...@@ -12,7 +12,7 @@ ...@@ -12,7 +12,7 @@
# #
############################################################################## ##############################################################################
name = "zc.buildout" name = "zc.buildout"
version = "1.4.3" version = "1.4.4"
import os import os
from setuptools import setup from setuptools import setup
...@@ -83,6 +83,7 @@ setup( ...@@ -83,6 +83,7 @@ setup(
install_requires = 'setuptools', install_requires = 'setuptools',
include_package_data = True, include_package_data = True,
entry_points = entry_points, entry_points = entry_points,
extras_require = dict(test=['zope.testing']),
zip_safe=False, zip_safe=False,
classifiers = [ classifiers = [
'Intended Audience :: Developers', 'Intended Audience :: Developers',
......
...@@ -121,7 +121,8 @@ Test for 1.0.5 breakage as in https://bugs.launchpad.net/zc.buildout/+bug/239212 ...@@ -121,7 +121,8 @@ Test for 1.0.5 breakage as in https://bugs.launchpad.net/zc.buildout/+bug/239212
... eggs=zc.buildout ... eggs=zc.buildout
... interpreter=python ... interpreter=python
... ''') ... ''')
>>> print system(buildout) >>> print 'XX'; print system(buildout) # doctest: +ELLIPSIS
X...
Unused options for buildout: 'foo'. Unused options for buildout: 'foo'.
Installing python. Installing python.
Generated script '/sample-buildout/bin/buildout'. Generated script '/sample-buildout/bin/buildout'.
......
...@@ -123,6 +123,22 @@ _buildout_default_options = _annotate_section({ ...@@ -123,6 +123,22 @@ _buildout_default_options = _annotate_section({
'log-format': '', 'log-format': '',
}, 'DEFAULT_VALUE') }, 'DEFAULT_VALUE')
# _buildout_version and _buildout_1_4_default_versions are part of a
# hack specific to zc.buildout 1.4.4. Search for
# _buildout_1_4_default_versions below to see the usage.
_buildout_version = pkg_resources.working_set.find(
pkg_resources.Requirement.parse('zc.buildout')).version
_buildout_1_4_default_versions = {
# Buildout and recipes that are likely to change to 1.5.0 sooner rather
# than later.
'zc.buildout': _buildout_version,
'zc.recipe.egg': '1.2.2',
'zc.recipe.testrunner': '1.3.0',
'z3c.recipe.i18n': '0.7.0',
'z3c.recipe.tag:': '0.3.0',
'djangorecipe': '0.20',
}
class Buildout(UserDict.DictMixin): class Buildout(UserDict.DictMixin):
...@@ -261,9 +277,16 @@ class Buildout(UserDict.DictMixin): ...@@ -261,9 +277,16 @@ class Buildout(UserDict.DictMixin):
options['newest'] = newest options['newest'] = newest
self.newest = newest == 'true' self.newest = newest == 'true'
versions = options.get('versions') # This is a hacked version of zc.buildout for 1.4.4.
if versions: # This means that buildout uses the defaults set up above. The point
zc.buildout.easy_install.default_versions(dict(self[versions])) # of it is to keep from migrating to 1.5 unless explicitly
# requested. This lets 1.4.4 be an "aspirin release" that people can
# use if they are having trouble with the 1.5 releases.
versions = _buildout_1_4_default_versions.copy()
versions_section = options.get('versions')
if versions_section:
versions.update(dict(self[versions_section]))
zc.buildout.easy_install.default_versions(versions)
prefer_final = options.get('prefer-final', 'false') prefer_final = options.get('prefer-final', 'false')
if prefer_final not in ('true', 'false'): if prefer_final not in ('true', 'false'):
......
...@@ -367,7 +367,8 @@ version information to be used when no version information is passes. ...@@ -367,7 +367,8 @@ version information to be used when no version information is passes.
If called with an argument, it sets the default versions: If called with an argument, it sets the default versions:
>>> zc.buildout.easy_install.default_versions(dict(demoneeded='1')) >>> zc.buildout.easy_install.default_versions(dict(demoneeded='1'))
{} ... # doctest: +ELLIPSIS
{...}
It always returns the previous default versions. If called without an It always returns the previous default versions. If called without an
argument, it simply returns the default versions without changing argument, it simply returns the default versions without changing
......
...@@ -15,7 +15,7 @@ The handers before calling set up are: ...@@ -15,7 +15,7 @@ The handers before calling set up are:
>>> len(logging.getLogger().handlers) >>> len(logging.getLogger().handlers)
1 1
>>> logging.getLogger().handlers # doctest: +ELLIPSIS >>> logging.getLogger().handlers # doctest: +ELLIPSIS
[<zope.testing.testrunner.logsupport.NullHandler instance at ...>] [<zope...testrunner.logsupport.NullHandler instance at ...>]
After calling it, a ``logging.StreamHandler`` was added: After calling it, a ``logging.StreamHandler`` was added:
...@@ -27,7 +27,7 @@ After calling it, a ``logging.StreamHandler`` was added: ...@@ -27,7 +27,7 @@ After calling it, a ``logging.StreamHandler`` was added:
>>> len(logging.getLogger().handlers) >>> len(logging.getLogger().handlers)
2 2
>>> logging.getLogger().handlers # doctest: +ELLIPSIS +NORMALIZE_WHITESPACE >>> logging.getLogger().handlers # doctest: +ELLIPSIS +NORMALIZE_WHITESPACE
[<zope.testing.testrunner.logsupport.NullHandler instance at ...>, [<zope...testrunner.logsupport.NullHandler instance at ...>,
<logging.StreamHandler instance at ...>] <logging.StreamHandler instance at ...>]
But tear down removes the new logging handler: But tear down removes the new logging handler:
...@@ -36,4 +36,4 @@ But tear down removes the new logging handler: ...@@ -36,4 +36,4 @@ But tear down removes the new logging handler:
>>> len(logging.getLogger().handlers) >>> len(logging.getLogger().handlers)
1 1
>>> logging.getLogger().handlers # doctest: +ELLIPSIS >>> logging.getLogger().handlers # doctest: +ELLIPSIS
[<zope.testing.testrunner.logsupport.NullHandler instance at ...>] [<zope...testrunner.logsupport.NullHandler instance at ...>]
...@@ -2779,37 +2779,33 @@ def easy_install_SetUp(test): ...@@ -2779,37 +2779,33 @@ def easy_install_SetUp(test):
egg_parse = re.compile('([0-9a-zA-Z_.]+)-([0-9a-zA-Z_.]+)-py(\d[.]\d).egg$' egg_parse = re.compile('([0-9a-zA-Z_.]+)-([0-9a-zA-Z_.]+)-py(\d[.]\d).egg$'
).match ).match
def makeNewRelease(project, ws, dest): def makeNewRelease(project, ws, dest, version='99.99'):
dist = ws.find(pkg_resources.Requirement.parse(project)) dist = ws.find(pkg_resources.Requirement.parse(project))
eggname, oldver, pyver = egg_parse( eggname, oldver, pyver = egg_parse(
os.path.basename(dist.location) os.path.basename(dist.location)
).groups() ).groups()
dest = os.path.join(dest, "%s-99.99-py%s.egg" % (eggname, pyver)) dest = os.path.join(dest, "%s-%s-py%s.egg" % (eggname, version, pyver))
if os.path.isfile(dist.location): if os.path.isfile(dist.location):
shutil.copy(dist.location, dest) shutil.copy(dist.location, dest)
zip = zipfile.ZipFile(dest, 'a') zip = zipfile.ZipFile(dest, 'a')
zip.writestr( zip.writestr(
'EGG-INFO/PKG-INFO', 'EGG-INFO/PKG-INFO',
zip.read('EGG-INFO/PKG-INFO').replace("Version: %s" % oldver, zip.read('EGG-INFO/PKG-INFO').replace("Version: %s" % oldver,
"Version: 99.99") "Version: %s" % version)
) )
zip.close() zip.close()
else: else:
shutil.copytree(dist.location, dest) shutil.copytree(dist.location, dest)
info_path = os.path.join(dest, 'EGG-INFO', 'PKG-INFO') info_path = os.path.join(dest, 'EGG-INFO', 'PKG-INFO')
info = open(info_path).read().replace("Version: %s" % oldver, info = open(info_path).read().replace("Version: %s" % oldver,
"Version: 99.99") "Version: %s" % version)
open(info_path, 'w').write(info) open(info_path, 'w').write(info)
def getWorkingSetWithBuildoutEgg(test):
def updateSetup(test):
zc.buildout.testing.buildoutSetUp(test)
new_releases = test.globs['tmpdir']('new_releases')
test.globs['new_releases'] = new_releases
sample_buildout = test.globs['sample_buildout'] sample_buildout = test.globs['sample_buildout']
eggs = os.path.join(sample_buildout, 'eggs') eggs = os.path.join(sample_buildout, 'eggs')
# If the zc.buildout dist is a develo dist, convert it to a # If the zc.buildout dist is a develop dist, convert it to a
# regular egg in the sample buildout # regular egg in the sample buildout
req = pkg_resources.Requirement.parse('zc.buildout') req = pkg_resources.Requirement.parse('zc.buildout')
dist = pkg_resources.working_set.find(req) dist = pkg_resources.working_set.find(req)
...@@ -2818,7 +2814,8 @@ def updateSetup(test): ...@@ -2818,7 +2814,8 @@ def updateSetup(test):
here = os.getcwd() here = os.getcwd()
os.chdir(os.path.dirname(dist.location)) os.chdir(os.path.dirname(dist.location))
assert os.spawnle( assert os.spawnle(
os.P_WAIT, sys.executable, zc.buildout.easy_install._safe_arg (sys.executable), os.P_WAIT, sys.executable,
zc.buildout.easy_install._safe_arg(sys.executable),
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,
dict(os.environ, dict(os.environ,
...@@ -2838,14 +2835,25 @@ def updateSetup(test): ...@@ -2838,14 +2835,25 @@ def updateSetup(test):
os.path.join(sample_buildout, 'bin')) os.path.join(sample_buildout, 'bin'))
else: else:
ws = pkg_resources.working_set ws = pkg_resources.working_set
return ws
def updateSetup(test):
zc.buildout.testing.buildoutSetUp(test)
new_releases = test.globs['tmpdir']('new_releases')
test.globs['new_releases'] = new_releases
ws = getWorkingSetWithBuildoutEgg(test)
# now let's make the new releases # now let's make the new releases
makeNewRelease('zc.buildout', ws, new_releases) makeNewRelease('zc.buildout', ws, new_releases)
makeNewRelease('setuptools', ws, new_releases)
os.mkdir(os.path.join(new_releases, 'zc.buildout')) os.mkdir(os.path.join(new_releases, 'zc.buildout'))
makeNewRelease('setuptools', ws, new_releases)
os.mkdir(os.path.join(new_releases, 'setuptools')) os.mkdir(os.path.join(new_releases, 'setuptools'))
def bootstrapSetup(test):
easy_install_SetUp(test)
sample_eggs = test.globs['sample_eggs']
ws = getWorkingSetWithBuildoutEgg(test)
makeNewRelease('zc.buildout', ws, sample_eggs, '1.4.4')
os.environ['bootstrap-testing-find-links'] = test.globs['link_server']
normalize_bang = ( normalize_bang = (
...@@ -3031,7 +3039,7 @@ def test_suite(): ...@@ -3031,7 +3039,7 @@ def test_suite():
if os.path.exists(bootstrap_py): if os.path.exists(bootstrap_py):
test_suite.append(doctest.DocFileSuite( test_suite.append(doctest.DocFileSuite(
'bootstrap.txt', 'bootstrap.txt',
setUp=easy_install_SetUp, setUp=bootstrapSetup,
tearDown=zc.buildout.testing.buildoutTearDown, tearDown=zc.buildout.testing.buildoutTearDown,
checker=renormalizing.RENormalizing([ checker=renormalizing.RENormalizing([
zc.buildout.testing.normalize_path, zc.buildout.testing.normalize_path,
......
Automatic Buildout Updates Automatic Buildout Updates
========================== ==========================
When a buildout is run, one of the first steps performed is to check NOTE: buildout 1.4.4 is a version that has been hacked to prefer itself, and
for updates to either zc.buildout or setuptools. To demonstrate this, not upgrade. It is intended as a way for people who have trouble with the new
we've creates some "new releases" of buildout and setuptools in a 1.5 line to easily keep from upgrading until they are ready. In the future,
new_releases folder: we suggest that you specify the versions of your dependencies using the
standard buildout mechanism
(http://pypi.python.org/pypi/zc.buildout#repeatable-buildouts-controlling-eggs-used).
However, for now, you can use 1.4.4 to easily control your dependencies.
When this file changes because of the hack, the documentation indicates this
with a "HACK" label.
When a buildout is run, one of the first steps performed is to check for
updates to either zc.buildout or setuptools (HACK: not zc.buildout). To
demonstrate this, we've created some "new releases" of buildout and
setuptools in a new_releases folder:
>>> ls(new_releases) >>> ls(new_releases)
d setuptools d setuptools
...@@ -61,31 +71,29 @@ zc.buildout used: ...@@ -61,31 +71,29 @@ zc.buildout used:
Now if we run the buildout, the buildout will upgrade itself to the Now if we run the buildout, the buildout will upgrade itself to the
new versions found in new releases: new versions found in new releases (HACK: only setuptools):
>>> print system(buildout), >>> print system(buildout),
Getting distribution for 'zc.buildout'.
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,
setuptools version 99.99; setuptools version 99.99;
restarting. restarting.
Generated script '/sample-buildout/bin/buildout'. Generated script '/sample-buildout/bin/buildout'.
Develop: '/sample-buildout/showversions' Develop: '/sample-buildout/showversions'
Installing show-versions. Installing show-versions.
zc.buildout 99.99 zc.buildout 1.4.4
setuptools 99.99 setuptools 99.99
Our buildout script has been updated to use the new eggs: Our buildout script has been updated to use the new eggs (HACK: only for
setuptools):
>>> cat(sample_buildout, 'bin', 'buildout') >>> cat(sample_buildout, 'bin', 'buildout')
#!/usr/local/bin/python2.4 #!/usr/local/bin/python2.4
<BLANKLINE> <BLANKLINE>
import sys import sys
sys.path[0:0] = [ sys.path[0:0] = [
'/sample-buildout/eggs/zc.buildout-99.99-py2.4.egg', '/sample-buildout/eggs/zc.buildout-1.4.4-py2.4.egg',
'/sample-buildout/eggs/setuptools-99.99-py2.4.egg', '/sample-buildout/eggs/setuptools-99.99-py2.4.egg',
] ]
<BLANKLINE> <BLANKLINE>
...@@ -95,8 +103,8 @@ Our buildout script has been updated to use the new eggs: ...@@ -95,8 +103,8 @@ Our buildout script has been updated to use the new eggs:
zc.buildout.buildout.main() zc.buildout.buildout.main()
Now, let's recreate the sample buildout. If we specify constraints on Now, let's recreate the sample buildout. If we specify constraints on
the versions of zc.buildout and setuptools to use, running the the versions of zc.buildout and setuptools to use, running the buildout
buildout will install earlier versions of these packages: will install earlier versions of these packages (HACK: only setuptools):
>>> write(sample_buildout, 'buildout.cfg', >>> write(sample_buildout, 'buildout.cfg',
... """ ... """
...@@ -116,7 +124,6 @@ Now we can see that we actually "upgrade" to an earlier version. ...@@ -116,7 +124,6 @@ Now we can see that we actually "upgrade" to an earlier version.
>>> print system(buildout), >>> print system(buildout),
Upgraded: Upgraded:
zc.buildout version 1.0.0,
setuptools version 0.6; setuptools version 0.6;
restarting. restarting.
Generated script '/sample-buildout/bin/buildout'. Generated script '/sample-buildout/bin/buildout'.
...@@ -175,8 +182,6 @@ directory: ...@@ -175,8 +182,6 @@ directory:
Creating directory '/sample_buildout2/parts'. Creating directory '/sample_buildout2/parts'.
Creating directory '/sample_buildout2/eggs'. Creating directory '/sample_buildout2/eggs'.
Creating directory '/sample_buildout2/develop-eggs'. Creating directory '/sample_buildout2/develop-eggs'.
Getting distribution for 'zc.buildout'.
Got zc.buildout 99.99.
Getting distribution for 'setuptools'. Getting distribution for 'setuptools'.
Got setuptools 99.99. Got setuptools 99.99.
Not upgrading because not running a local buildout command. Not upgrading because not running a local buildout command.
......
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