Commit 5674dd73 authored by jim's avatar jim

Added missing for controlling upgrades by specifying versions for

setuptools and zc.buildout.

Don't upgrade if the buildout command is non-local.


git-svn-id: http://svn.zope.org/repos/main/zc.buildout/trunk@70580 62d5b8a3-27da-0310-9561-8e5933582275
parent 70d92479
...@@ -44,6 +44,12 @@ Bugs Fixed ...@@ -44,6 +44,12 @@ Bugs Fixed
- Egg links weren't removed when corresponding entries were removed - Egg links weren't removed when corresponding entries were removed
from develop sections. from develop sections.
- Running a non-local buildout command (one not installed in the
buildout) ket to a hang if there were new versions of zc.buildout or
setuptools were available. Now we issue a warning and don't
upgrade.
1.0.0b9 (2006-10-02) 1.0.0b9 (2006-10-02)
==================== ====================
......
...@@ -659,6 +659,14 @@ class Buildout(dict): ...@@ -659,6 +659,14 @@ class Buildout(dict):
if not upgraded: if not upgraded:
return return
if (os.path.abspath(sys.argv[0])
!= os.path.join(os.path.abspath(self['buildout']['bin-directory']),
'buildout')
):
self._logger.warn("Not upgrading because not running a local "
"buildout command")
return
if sys.platform == 'win32' and not self.__windows_restart: if sys.platform == 'win32' and not self.__windows_restart:
args = map(zc.buildout.easy_install._safe_arg, sys.argv) args = map(zc.buildout.easy_install._safe_arg, sys.argv)
args.insert(1, '-W') args.insert(1, '-W')
......
...@@ -720,6 +720,8 @@ def updateSetup(test): ...@@ -720,6 +720,8 @@ def updateSetup(test):
os.mkdir(os.path.join(new_releases, 'zc.buildout')) os.mkdir(os.path.join(new_releases, 'zc.buildout'))
os.mkdir(os.path.join(new_releases, 'setuptools')) os.mkdir(os.path.join(new_releases, 'setuptools'))
normalize_bang = ( normalize_bang = (
re.compile(re.escape('#!'+sys.executable)), re.compile(re.escape('#!'+sys.executable)),
'#!/usr/local/bin/python2.4', '#!/usr/local/bin/python2.4',
...@@ -757,6 +759,12 @@ def test_suite(): ...@@ -757,6 +759,12 @@ def test_suite():
zc.buildout.testing.normalize_script, zc.buildout.testing.normalize_script,
zc.buildout.testing.normalize_egg_py, zc.buildout.testing.normalize_egg_py,
normalize_bang, normalize_bang,
(re.compile('99[.]99'), 'NINETYNINE.NINETYNINE'),
(re.compile('(zc.buildout|setuptools)-\d+[.]\d+\S*'
'-py\d.\d.egg'),
'\\1.egg'),
(re.compile('(zc.buildout|setuptools)( version)? \d+[.]\d+\S*'),
'\\1 V.V'),
]) ])
), ),
......
...@@ -26,7 +26,7 @@ Let's update the sample buildout.cfg to look in this area: ...@@ -26,7 +26,7 @@ Let's update the sample buildout.cfg to look in this area:
... recipe = showversions ... recipe = showversions
... """ % dict(new_releases=new_releases)) ... """ % dict(new_releases=new_releases))
We'll also include a recipe that echos the version sof setuptools and We'll also include a recipe that echos the versions of setuptools and
zc.buildout used: zc.buildout used:
>>> mkdir(sample_buildout, 'showversions') >>> mkdir(sample_buildout, 'showversions')
...@@ -45,6 +45,7 @@ zc.buildout used: ...@@ -45,6 +45,7 @@ zc.buildout used:
... req = pkg_resources.Requirement.parse(project) ... req = pkg_resources.Requirement.parse(project)
... print project, pkg_resources.working_set.find(req).version ... print project, pkg_resources.working_set.find(req).version
... return () ... return ()
... update = install
... """) ... """)
...@@ -93,3 +94,84 @@ Our buildout script has been updated to use the new eggs: ...@@ -93,3 +94,84 @@ Our buildout script has been updated to use the new eggs:
<BLANKLINE> <BLANKLINE>
if __name__ == '__main__': if __name__ == '__main__':
zc.buildout.buildout.main() zc.buildout.buildout.main()
There are a number of cases in which the updates don't happen.
Let's recreate the sample buildout. One case is the one in which we
specify versions of zc.buildout and setuptools for which the don't
match. If we update out configuration file to specify an older
version:
>>> write(sample_buildout, 'buildout.cfg',
... """
... [buildout]
... find-links = %(new_releases)s
... index = %(new_releases)s
... parts = show-versions
... develop = showversions
... zc.buildout-version = < 99
... setuptools-version = < 99
...
... [show-versions]
... recipe = showversions
... """ % dict(new_releases=new_releases))
We'll actually "upgrade" to an earlier version.
>>> print system(buildout),
buildout: Upgraded:
zc.buildout version 1.0.0,
setuptools version 0.6;
restarting.
buildout: Develop: /sample-buildout/showversions/setup.py
buildout: Updating show-versions
zc.buildout 1.0.0
setuptools 0.6
We won't upgrade in offline mode:
>>> write(sample_buildout, 'buildout.cfg',
... """
... [buildout]
... find-links = %(new_releases)s
... index = %(new_releases)s
... parts = show-versions
... develop = showversions
... offline = true
...
... [show-versions]
... recipe = showversions
... """ % dict(new_releases=new_releases))
>>> print system(buildout),
buildout: Develop: /sample-buildout/showversions/setup.py
buildout: Updating show-versions
zc.buildout 1.0.0
setuptools 0.6
We also won't upgrade if the buildout script bing run isn't in the
buildouts bin directory. To see this we'll create a new buildout
directory:
>>> sample_buildout2 = tmpdir('sample_buildout2')
>>> write(sample_buildout2, 'buildout.cfg',
... """
... [buildout]
... find-links = %(new_releases)s
... index = %(new_releases)s
... parts =
... """ % dict(new_releases=new_releases))
>>> cd(sample_buildout2)
>>> print system(buildout),
buildout: Creating directory /sample_buildout2/bin
buildout: Creating directory /sample_buildout2/parts
buildout: Creating directory /sample_buildout2/eggs
buildout: Creating directory /sample_buildout2/develop-eggs
zc.buildout.easy_install: Getting new distribution for zc.buildout
zc.buildout.easy_install: Got zc.buildout 99.99
zc.buildout.easy_install: Getting new distribution for setuptools
zc.buildout.easy_install: Got setuptools 99.99
buildout: Not upgrading because not running a local buildout command
>>> ls('bin')
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