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

the "aspirin" release.

parent 70f63c8e
......@@ -2,6 +2,11 @@
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::
The Buildout project provides support for creating applications,
......@@ -126,7 +131,7 @@ If I need to run a previous version of zc.buildout, I use the
`--version` option of the bootstrap.py script::
$ python bootstrap.py --version 1.1.3
The `zc.buildout project <http://svn.zope.org/zc.buildout/trunk>`_
is a slightly more complex example of this type of buildout.
......
......@@ -28,9 +28,14 @@ tmpeggs = tempfile.mkdtemp()
is_jython = sys.platform.startswith('java')
# parsing arguments
parser = OptionParser()
parser.add_option("-v", "--version", dest="version",
help="use a specific zc.buildout version")
parser = OptionParser(
'This is a custom version of the zc.buildout %prog script. It is '
'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",
action="store_true", dest="distribute", default=False,
help="Use Disribute rather than Setuptools.")
......@@ -85,7 +90,6 @@ else:
def quote (c):
return c
cmd = 'from setuptools.command.easy_install import main; main()'
ws = pkg_resources.working_set
if USE_DISTRIBUTE:
......@@ -93,26 +97,28 @@ if USE_DISTRIBUTE:
else:
requirement = 'setuptools'
if is_jython:
import subprocess
env = dict(os.environ,
PYTHONPATH=
ws.find(pkg_resources.Requirement.parse(requirement)).location
)
assert subprocess.Popen([sys.executable] + ['-c', quote(cmd), '-mqNxd',
quote(tmpeggs), 'zc.buildout' + VERSION],
env=dict(os.environ,
PYTHONPATH=
ws.find(pkg_resources.Requirement.parse(requirement)).location
),
).wait() == 0
cmd = [quote(sys.executable),
'-c',
quote('from setuptools.command.easy_install import main; main()'),
'-mqNxd',
quote(tmpeggs)]
else:
assert os.spawnle(
os.P_WAIT, sys.executable, quote (sys.executable),
'-c', quote (cmd), '-mqNxd', quote (tmpeggs), 'zc.buildout' + VERSION,
dict(os.environ,
PYTHONPATH=
ws.find(pkg_resources.Requirement.parse(requirement)).location
),
) == 0
if 'bootstrap-testing-find-links' in os.environ:
cmd.extend(['-f', os.environ['bootstrap-testing-find-links']])
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.require('zc.buildout' + VERSION)
......
......@@ -10,15 +10,15 @@ interpreter = py
[test]
recipe = zc.recipe.testrunner
eggs =
zc.buildout
eggs =
zc.buildout[test]
zc.recipe.egg
# Tests that can be run wo a network
[oltest]
recipe = zc.recipe.testrunner
eggs =
zc.buildout
eggs =
zc.buildout[test]
zc.recipe.egg
defaults =
[
......
......@@ -12,7 +12,7 @@
#
##############################################################################
name = "zc.buildout"
version = "1.4.3"
version = "1.4.4"
import os
from setuptools import setup
......@@ -83,6 +83,7 @@ setup(
install_requires = 'setuptools',
include_package_data = True,
entry_points = entry_points,
extras_require = dict(test=['zope.testing']),
zip_safe=False,
classifiers = [
'Intended Audience :: Developers',
......
......@@ -2,14 +2,14 @@ Allow hosts
-----------
On some environments the links visited by `zc.buildout` can be forbidden
by paranoiac firewalls. These URL might be on the chain of links
by paranoiac firewalls. These URL might be on the chain of links
visited by `zc.buildout` whether they are defined in the `find-links` option
or by various eggs in their `url`, `download_url` and `dependency_links` metadata.
It is even harder to track that package_index works like a spider and
It is even harder to track that package_index works like a spider and
might visit links and go to other location.
The `allow-hosts` option provides a way to prevent this, and
The `allow-hosts` option provides a way to prevent this, and
works exactly like the one provided in `easy_install`
(see `easy_install allow-hosts option`_).
......@@ -17,7 +17,7 @@ You can provide a list of allowed host, together with wildcards::
[buildout]
...
allow-hosts =
*.python.org
example.com
......@@ -36,7 +36,7 @@ Let's create a develop egg in our buildout that specifies
... zip_safe=True, version='1')
... ''')
Now let's configure the buildout to use the develop egg,
Now let's configure the buildout to use the develop egg,
together with some rules that disallow any website but PyPI and
local files::
......@@ -115,13 +115,14 @@ Test for 1.0.5 breakage as in https://bugs.launchpad.net/zc.buildout/+bug/239212
... [buildout]
... parts=python
... foo = ${python:interpreter}
...
...
... [python]
... recipe=zc.recipe.egg
... eggs=zc.buildout
... interpreter=python
... ''')
>>> print system(buildout)
>>> print 'XX'; print system(buildout) # doctest: +ELLIPSIS
X...
Unused options for buildout: 'foo'.
Installing python.
Generated script '/sample-buildout/bin/buildout'.
......
......@@ -123,6 +123,22 @@ _buildout_default_options = _annotate_section({
'log-format': '',
}, '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):
......@@ -261,9 +277,16 @@ class Buildout(UserDict.DictMixin):
options['newest'] = newest
self.newest = newest == 'true'
versions = options.get('versions')
if versions:
zc.buildout.easy_install.default_versions(dict(self[versions]))
# This is a hacked version of zc.buildout for 1.4.4.
# This means that buildout uses the defaults set up above. The point
# 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')
if prefer_final not in ('true', 'false'):
......
......@@ -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:
>>> zc.buildout.easy_install.default_versions(dict(demoneeded='1'))
{}
... # doctest: +ELLIPSIS
{...}
It always returns the previous default versions. If called without an
argument, it simply returns the default versions without changing
......
......@@ -15,7 +15,7 @@ The handers before calling set up are:
>>> len(logging.getLogger().handlers)
1
>>> 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:
......@@ -27,7 +27,7 @@ After calling it, a ``logging.StreamHandler`` was added:
>>> len(logging.getLogger().handlers)
2
>>> logging.getLogger().handlers # doctest: +ELLIPSIS +NORMALIZE_WHITESPACE
[<zope.testing.testrunner.logsupport.NullHandler instance at ...>,
[<zope...testrunner.logsupport.NullHandler instance at ...>,
<logging.StreamHandler instance at ...>]
But tear down removes the new logging handler:
......@@ -36,4 +36,4 @@ But tear down removes the new logging handler:
>>> len(logging.getLogger().handlers)
1
>>> 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):
egg_parse = re.compile('([0-9a-zA-Z_.]+)-([0-9a-zA-Z_.]+)-py(\d[.]\d).egg$'
).match
def makeNewRelease(project, ws, dest):
def makeNewRelease(project, ws, dest, version='99.99'):
dist = ws.find(pkg_resources.Requirement.parse(project))
eggname, oldver, pyver = egg_parse(
os.path.basename(dist.location)
).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):
shutil.copy(dist.location, dest)
zip = zipfile.ZipFile(dest, 'a')
zip.writestr(
'EGG-INFO/PKG-INFO',
zip.read('EGG-INFO/PKG-INFO').replace("Version: %s" % oldver,
"Version: 99.99")
"Version: %s" % version)
)
zip.close()
else:
shutil.copytree(dist.location, dest)
info_path = os.path.join(dest, 'EGG-INFO', 'PKG-INFO')
info = open(info_path).read().replace("Version: %s" % oldver,
"Version: 99.99")
"Version: %s" % version)
open(info_path, 'w').write(info)
def updateSetup(test):
zc.buildout.testing.buildoutSetUp(test)
new_releases = test.globs['tmpdir']('new_releases')
test.globs['new_releases'] = new_releases
def getWorkingSetWithBuildoutEgg(test):
sample_buildout = test.globs['sample_buildout']
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
req = pkg_resources.Requirement.parse('zc.buildout')
dist = pkg_resources.working_set.find(req)
......@@ -2818,7 +2814,8 @@ def updateSetup(test):
here = os.getcwd()
os.chdir(os.path.dirname(dist.location))
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'),
'-q', 'bdist_egg', '-d', eggs,
dict(os.environ,
......@@ -2838,14 +2835,25 @@ def updateSetup(test):
os.path.join(sample_buildout, 'bin'))
else:
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
makeNewRelease('zc.buildout', ws, new_releases)
makeNewRelease('setuptools', ws, new_releases)
os.mkdir(os.path.join(new_releases, 'zc.buildout'))
makeNewRelease('setuptools', ws, new_releases)
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 = (
......@@ -3031,7 +3039,7 @@ def test_suite():
if os.path.exists(bootstrap_py):
test_suite.append(doctest.DocFileSuite(
'bootstrap.txt',
setUp=easy_install_SetUp,
setUp=bootstrapSetup,
tearDown=zc.buildout.testing.buildoutTearDown,
checker=renormalizing.RENormalizing([
zc.buildout.testing.normalize_path,
......
Automatic Buildout Updates
==========================
When a buildout is run, one of the first steps performed is to check
for updates to either zc.buildout or setuptools. To demonstrate this,
we've creates some "new releases" of buildout and setuptools in a
new_releases folder:
NOTE: buildout 1.4.4 is a version that has been hacked to prefer itself, and
not upgrade. It is intended as a way for people who have trouble with the new
1.5 line to easily keep from upgrading until they are ready. In the future,
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)
d setuptools
......@@ -61,31 +71,29 @@ zc.buildout used:
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),
Getting distribution for 'zc.buildout'.
Got zc.buildout 99.99.
Getting distribution for 'setuptools'.
Got setuptools 99.99.
Upgraded:
zc.buildout version 99.99,
setuptools version 99.99;
restarting.
Generated script '/sample-buildout/bin/buildout'.
Develop: '/sample-buildout/showversions'
Installing show-versions.
zc.buildout 99.99
zc.buildout 1.4.4
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')
#!/usr/local/bin/python2.4
<BLANKLINE>
import sys
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',
]
<BLANKLINE>
......@@ -95,8 +103,8 @@ Our buildout script has been updated to use the new eggs:
zc.buildout.buildout.main()
Now, let's recreate the sample buildout. If we specify constraints on
the versions of zc.buildout and setuptools to use, running the
buildout will install earlier versions of these packages:
the versions of zc.buildout and setuptools to use, running the buildout
will install earlier versions of these packages (HACK: only setuptools):
>>> write(sample_buildout, 'buildout.cfg',
... """
......@@ -116,7 +124,6 @@ Now we can see that we actually "upgrade" to an earlier version.
>>> print system(buildout),
Upgraded:
zc.buildout version 1.0.0,
setuptools version 0.6;
restarting.
Generated script '/sample-buildout/bin/buildout'.
......@@ -175,8 +182,6 @@ directory:
Creating directory '/sample_buildout2/parts'.
Creating directory '/sample_buildout2/eggs'.
Creating directory '/sample_buildout2/develop-eggs'.
Getting distribution for 'zc.buildout'.
Got zc.buildout 99.99.
Getting distribution for 'setuptools'.
Got setuptools 99.99.
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