Commit fc779f59 authored by Jim Fulton's avatar Jim Fulton

Unless version requirements are specified, buildout won't upgrade

itself past version 1.
parent 337b8968
......@@ -10,6 +10,9 @@ Change History
- If buildout is bootstrapped with a non-final release, it
won't downgrade itself to a final release.
- Unless version requirements are specified, buildout won't upgrade
itself past version 1.
- Fix: distribute 0.6.33 broke Python 2.4 compatibility
- remove `data_files` from `setup.py`, which was installing README.txt
......
......@@ -231,6 +231,8 @@ if version is None and not options.accept_buildout_test_releases:
bestv = None
for dist in index[req.project_name]:
distv = dist.parsed_version
if distv >= pkg_resources.parse_version('2dev'):
continue
if _final_version(distv):
if bestv is None or distv > bestv:
best = [dist]
......@@ -240,8 +242,12 @@ if version is None and not options.accept_buildout_test_releases:
if best:
best.sort()
version = best[-1].version
if version:
requirement = '=='.join((requirement, version))
requirement += '=='+version
else:
requirement += '<2dev'
cmd.append(requirement)
if is_jython:
......
......@@ -86,7 +86,7 @@ selected the (generated-locally) 99.99 egg rather than the also-available
"...
buildout_paths = [
'/sample/eggs/setuptools-...egg',
'/sample/eggs/zc.buildout-99.99-pyN.N.egg'
'/sample/eggs/zc.buildout-1.99.99-pyN.N.egg'
]
...
......@@ -106,11 +106,11 @@ Here's an example.
"...
buildout_paths = [
'/sample/eggs/setuptools-...egg',
'/sample/eggs/zc.buildout-100.0b1-pyN.N.egg'
'/sample/eggs/zc.buildout-1.100.0b1-pyN.N.egg'
]
...
Notice we are now using zc.buildout 100.0b1, a non-final release.
Notice we are now using zc.buildout 1.100.0b1, a non-final release.
The buildout script remembers the decision to accept early releases, and
alerts the user.
......@@ -141,7 +141,7 @@ As the note says, to undo, you just need to re-run bootstrap without
"...
buildout_paths = [
'/sample/eggs/setuptools-...egg',
'/sample/eggs/zc.buildout-99.99-pyN.N.egg'
'/sample/eggs/zc.buildout-1.99.99-pyN.N.egg'
]
...
>>> ('buildout:accept-buildout-test-releases=true' in
......@@ -232,7 +232,7 @@ Let's make sure the generated ``site.py`` uses it::
"...
buildout_paths = [
'/sample/eggs/distribute-...egg',
'/sample/eggs/zc.buildout-99.99-pyN.N.egg'
'/sample/eggs/zc.buildout-1.99.99-pyN.N.egg'
]
...
......
......@@ -898,7 +898,7 @@ class Buildout(UserDict.DictMixin):
v = pkg_resources.working_set.find(
pkg_resources.Requirement.parse('zc.buildout')
).version
options['zc.buildout-version'] = '>=' + v
options['zc.buildout-version'] = '>=' + v + ', <2dev'
ws = zc.buildout.easy_install.install(
[
......
......@@ -2259,7 +2259,7 @@ database is shown.
... """)
>>> print system(buildout+' -vv'), # doctest: +NORMALIZE_WHITESPACE
Installing 'zc.buildout >=1.9a1', 'setuptools'.
Installing 'zc.buildout >=1.9a1, <2dev', 'setuptools'.
We have a develop egg: zc.buildout X.X.
We have the best distribution that satisfies 'setuptools'.
Picked: setuptools = V.V
......@@ -2293,7 +2293,7 @@ database is shown.
unzip = false
use-dependency-links = true
verbosity = 20
zc.buildout-version = >=1.9a1
zc.buildout-version = >=1.9a1, <2dev
<BLANKLINE>
All of these options can be overridden by configuration files or by
......
......@@ -124,7 +124,7 @@ about versions used. If we run the buildout in verbose mode without
specifying a versions section:
>>> print system(buildout+' buildout:versions= -v'), # doctest: +ELLIPSIS
Installing 'zc.buildout >=1.99', 'setuptools'.
Installing 'zc.buildout >=1.99, <2dev', 'setuptools'.
We have a develop egg: zc.buildout 1.0.0.
We have the best distribution that satisfies 'setuptools'.
Picked: setuptools = 0.6
......@@ -146,7 +146,7 @@ that we can fix them in a versions section.
If we run the buildout with the versions section:
>>> print system(buildout+' -v'), # doctest: +ELLIPSIS
Installing 'zc.buildout >=1.99', 'setuptools'.
Installing 'zc.buildout >=1.99, <2dev', 'setuptools'.
We have a develop egg: zc.buildout 1.0.0.
We have the best distribution that satisfies 'setuptools'.
Picked: setuptools = 0.6
......
......@@ -321,7 +321,7 @@ if we hadn't required sampley ourselves:
If we use the verbose switch, we can see where requirements are coming from:
>>> print system(buildout+' -v'), # doctest: +ELLIPSIS
Installing 'zc.buildout >=1.99', 'setuptools'.
Installing 'zc.buildout >=1.99, <2dev', 'setuptools'.
We have a develop egg: zc.buildout 1.0.0
We have the best distribution that satisfies 'setuptools'.
Picked: setuptools = 0.6
......@@ -420,7 +420,7 @@ indicate the eggs from site-packages that have been selected. You'll see
we have two: demo 0.3 and demoneeded 1.1.
>>> print system(buildout+" -v"),
Installing 'zc.buildout >=1.9.0', 'setuptools'.
Installing 'zc.buildout >=1.9.0, <2dev', 'setuptools'.
We have a develop egg: zc.buildout V
We have the best distribution that satisfies 'setuptools'.
Picked: setuptools = V
......@@ -616,7 +616,7 @@ def create_sections_on_command_line():
... ''')
>>> print system(buildout + ' foo:bar=1 -vv'), # doctest: +ELLIPSIS
Installing 'zc.buildout >=1.99', 'setuptools'.
Installing 'zc.buildout >=1.99, <2dev', 'setuptools'.
...
[foo]
bar = 1
......@@ -2801,7 +2801,7 @@ def dealing_with_extremely_insane_dependencies():
However, if we run in verbose mode, we can see why packages were included:
>>> print system(buildout+' -v'), # doctest: +ELLIPSIS
Installing 'zc.buildout >=1.9.0', 'setuptools'.
Installing 'zc.buildout >=1.9.0, <2dev', 'setuptools'.
We have a develop egg: zc.buildout 1.0.0
We have the best distribution that satisfies 'setuptools'.
Picked: setuptools = 0.6
......@@ -3092,7 +3092,7 @@ The default is prefer-final = false:
... ''' % globals())
>>> print system(buildout+' -v'), # doctest: +ELLIPSIS
Installing 'zc.buildout >=1.99', 'setuptools'.
Installing 'zc.buildout >=1.99, <2dev', 'setuptools'.
...
Picked: demo = 0.4c1
...
......@@ -3114,7 +3114,7 @@ We get the same behavior if we add prefer-final = false
... ''' % globals())
>>> print system(buildout+' -v'), # doctest: +ELLIPSIS
Installing 'zc.buildout >=1.99', 'setuptools'.
Installing 'zc.buildout >=1.99, <2dev', 'setuptools'.
...
Picked: demo = 0.4c1
...
......@@ -3136,7 +3136,7 @@ distributions:
... ''' % globals())
>>> print system(buildout+' -v'), # doctest: +ELLIPSIS
Installing 'zc.buildout >=1.99', 'setuptools'.
Installing 'zc.buildout >=1.99, <2dev', 'setuptools'.
...
Picked: demo = 0.3
...
......@@ -3167,7 +3167,7 @@ def wont_downgrade_due_to_prefer_final():
If we install a non-final buildout version, we don't want to
downgrade just bcause we prefer-final. If a buildout version
isn't specified, either through buildout-version or a versions
entry, then buildout-version gets set to >=CURRENT_VERSION.
entry, then buildout-version gets set to >=CURRENT_VERSION, <2dev.
>>> write('buildout.cfg',
... '''
......@@ -3179,7 +3179,7 @@ def wont_downgrade_due_to_prefer_final():
... if l.startswith('zc.buildout-version = ')]
>>> v == '>=' + pkg_resources.working_set.find(
... pkg_resources.Requirement.parse('zc.buildout')
... ).version
... ).version+', <2dev'
True
>>> write('buildout.cfg',
......@@ -3952,7 +3952,7 @@ def buildout_txt_setup(test):
egg_parse = re.compile('([0-9a-zA-Z_.]+)-([0-9a-zA-Z_.]+)-py(\d[.]\d).egg$'
).match
def makeNewRelease(project, ws, dest, version='99.99'):
def makeNewRelease(project, ws, dest, version='1.99.99'):
dist = ws.find(pkg_resources.Requirement.parse(project))
eggname, oldver, pyver = egg_parse(
os.path.basename(dist.location)
......@@ -4017,7 +4017,8 @@ def updateSetup(test):
ws = getWorkingSetWithBuildoutEgg(test)
# now let's make the new releases
makeNewRelease('zc.buildout', ws, new_releases)
makeNewRelease('zc.buildout', ws, new_releases, '100.0b1')
makeNewRelease('zc.buildout', ws, new_releases, '1.100.0b1')
makeNewRelease('zc.buildout', ws, new_releases, '2.0.0')
os.mkdir(os.path.join(new_releases, 'zc.buildout'))
if zc.buildout.easy_install.is_distribute:
makeNewRelease('distribute', ws, new_releases)
......@@ -4031,7 +4032,8 @@ def bootstrapSetup(test):
sample_eggs = test.globs['sample_eggs']
ws = getWorkingSetWithBuildoutEgg(test)
makeNewRelease('zc.buildout', ws, sample_eggs)
makeNewRelease('zc.buildout', ws, sample_eggs, '100.0b1')
makeNewRelease('zc.buildout', ws, sample_eggs, '1.100.0b1')
makeNewRelease('zc.buildout', ws, sample_eggs, '2.0.0')
os.environ['bootstrap-testing-find-links'] = test.globs['link_server']
normalize_bang = (
......@@ -4066,8 +4068,8 @@ def test_suite():
zc.buildout.testing.normalize_egg_py,
zc.buildout.tests.hide_distribute_additions,
hide_zip_safe_message,
(re.compile(r'zc.buildout-version = >=\S+'), ''),
(re.compile(r"Installing 'zc.buildout >=\S+"), ''),
(re.compile(r'zc.buildout-version = >=\S+, <2dev'), ''),
(re.compile(r"Installing 'zc.buildout >=\S+, <2dev"), ''),
(re.compile('__buildout_signature__ = recipes-\S+'),
'__buildout_signature__ = recipes-SSSSSSSSSSS'),
(re.compile('executable = [\S ]+python\S*', re.I),
......@@ -4103,8 +4105,9 @@ def test_suite():
zc.buildout.testing.normalize_egg_py,
zc.buildout.tests.hide_distribute_additions,
hide_zip_safe_message,
(re.compile(r"Installing 'zc.buildout >=\S+"), ''),
(re.compile(r"Getting distribution for 'zc.buildout >=\S+"),
(re.compile(r"Installing 'zc.buildout >=\S+, <2dev"), ''),
(re.compile(
r"Getting distribution for 'zc.buildout >=\S+, <2dev"),
''),
(re.compile('__buildout_signature__ = recipes-\S+'),
'__buildout_signature__ = recipes-SSSSSSSSSSS'),
......@@ -4154,8 +4157,9 @@ def test_suite():
zc.buildout.testing.normalize_egg_py,
normalize_bang,
zc.buildout.tests.hide_distribute_additions,
(re.compile(r"Installing 'zc.buildout >=\S+"), ''),
(re.compile(r"Getting distribution for 'zc.buildout>=\S+"),
(re.compile(r"Installing 'zc.buildout >=\S+, <2dev"), ''),
(re.compile(
r"Getting distribution for 'zc.buildout>=\S+, *<2dev"),
''),
(re.compile('99[.]99'), 'NINETYNINE.NINETYNINE'),
(re.compile('(zc.buildout|setuptools)-\d+[.]\d+\S*'
......@@ -4232,7 +4236,8 @@ def test_suite():
zc.buildout.testing.normalize_egg_py,
zc.buildout.tests.hide_distribute_additions,
hide_first_index_page_message,
(re.compile(r"Installing 'zc.buildout >=\S+"), 'Installing '),
(re.compile(r"Installing 'zc.buildout >=\S+, <2dev"),
'Installing '),
(re.compile(r'^(\w+\.)*(Missing\w+: )'), '\2'),
(re.compile("buildout: Running \S*setup.py"),
'buildout: Running setup.py'),
......
......@@ -8,10 +8,11 @@ new_releases folder:
>>> ls(new_releases)
d setuptools
- setuptools-99.99-py2.4.egg
- setuptools-1.99.99-py2.4.egg
d zc.buildout
- zc.buildout-100.0b1-pyN.N.egg
- zc.buildout-99.99-py2.4.egg
- zc.buildout-1.100.0b1-pyN.N.egg
- zc.buildout-1.99.99-py2.4.egg
- zc.buildout-2.0.0-pyN.N.egg
Let's update the sample buildout.cfg to look in this area:
......@@ -65,27 +66,30 @@ Now if we run the buildout, the buildout will upgrade itself to the
new versions found in new releases:
>>> print system(buildout),
Getting distribution for 'zc.buildout>=1.99'.
Got zc.buildout 99.99.
Getting distribution for 'zc.buildout>=1.99, <2dev'.
Got zc.buildout 1.99.99.
Getting distribution for 'setuptools'.
Got setuptools 99.99.
Got setuptools 1.99.99.
Upgraded:
zc.buildout version 99.99,
setuptools version 99.99;
zc.buildout version 1.99.99,
setuptools version 1.99.99;
restarting.
Generated script '/sample-buildout/bin/buildout'.
Develop: '/sample-buildout/showversions'
Installing show-versions.
zc.buildout 99.99
setuptools 99.99
zc.buildout 1.99.99
setuptools 1.99.99
Notice that, even though we have a newer beta version of zc.buildout
available, the final "99.99" was selected. If you want to get non-final
available, the final "1.99.99" was selected. If you want to get non-final
versions, specify a specific version in your buildout's versions
section, you typically want to use the --accept-buildout-test-releases
option to the bootstrap script, which internally uses the
``accept-buildout-test-releases = true`` discussed below.
Also, even thought there's a later final version, buildout won't
upgrade itself past version 1.
Our buildout script's site.py has been updated to use the new eggs:
>>> cat(sample_buildout, 'parts', 'buildout', 'site.py')
......@@ -95,13 +99,13 @@ Our buildout script's site.py has been updated to use the new eggs:
"""Add site packages, as determined by zc.buildout.
<BLANKLINE>
See original_addsitepackages, below, for the original version."""
setuptools_path = '/sample-buildout/eggs/setuptools-99.99-pyN.N.egg'
setuptools_path = '/sample-buildout/eggs/setuptools-1.99.99-pyN.N.egg'
sys.path.append(setuptools_path)
known_paths.add(os.path.normcase(setuptools_path))
import pkg_resources
buildout_paths = [
'/sample-buildout/eggs/zc.buildout-99.99-pyN.N.egg',
'/sample-buildout/eggs/setuptools-99.99-pyN.N.egg'
'/sample-buildout/eggs/zc.buildout-1.99.99-pyN.N.egg',
'/sample-buildout/eggs/setuptools-1.99.99-pyN.N.egg'
]
for path in buildout_paths:
sitedir, sitedircase = makepath(path)
......@@ -130,9 +134,9 @@ running the buildout will install earlier versions of these packages:
... index = %(new_releases)s
... parts = show-versions
... develop = showversions
... zc.buildout-version = < 99
... setuptools-version = < 99
... distribute-version = < 99
... zc.buildout-version = < 1.99
... setuptools-version = < 1.99
... distribute-version = < 1.99
...
... [show-versions]
... recipe = showversions
......@@ -200,10 +204,10 @@ directory:
Creating directory '/sample_buildout2/parts'.
Creating directory '/sample_buildout2/eggs'.
Creating directory '/sample_buildout2/develop-eggs'.
Getting distribution for 'zc.buildout>=1.99'.
Got zc.buildout 99.99.
Getting distribution for 'zc.buildout>=1.99, <2dev'.
Got zc.buildout 1.99.99.
Getting distribution for 'setuptools'.
Got setuptools 99.99.
Got setuptools 1.99.99.
Not upgrading because not running a local buildout command.
>>> ls('bin')
......@@ -233,11 +237,11 @@ We'll mimic this by passing the argument actually in the command line.
>>> print system(buildout +
... ' buildout:accept-buildout-test-releases=true'),
... # doctest: +NORMALIZE_WHITESPACE
Getting distribution for 'zc.buildout>=1.99'.
Got zc.buildout 100.0b1.
Getting distribution for 'zc.buildout>=1.99, <2dev'.
Got zc.buildout 1.100.0b1.
Upgraded:
zc.buildout version 100.0b1,
setuptools version 99.99;
zc.buildout version 1.100.0b1,
setuptools version 1.99.99;
restarting.
Generated script '/sample-buildout/bin/buildout'.
NOTE: Accepting early releases of build system packages. Rerun bootstrap
......@@ -245,8 +249,8 @@ We'll mimic this by passing the argument actually in the command line.
behavior.
Develop: '/sample-buildout/showversions'
Updating show-versions.
zc.buildout 100.0b1
setuptools 99.99
zc.buildout 1.100.0b1
setuptools 1.99.99
The buildout script shows the change.
......@@ -267,8 +271,8 @@ caught (displaying a warning) and the rest of the buildout update process
should continue.
>>> version = sys.version_info[0:2]
>>> egg = new_releases + '/zc.buildout-99.99-py%s.%s.egg' % version
>>> copy_egg = new_releases + '/zc.buildout-1000-py%s.%s.egg' % version
>>> egg = new_releases + '/zc.buildout-1.99.99-py%s.%s.egg' % version
>>> copy_egg = new_releases + '/zc.buildout-1.1000-py%s.%s.egg' % version
>>> import shutil
>>> shutil.copy(egg, copy_egg)
......
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