Commit b89faeff authored by reinout's avatar reinout

Merged -r105475:105584...

Merged -r105475:105584 svn+ssh://reinout@svn.zope.org/repos/main/zc.buildout/branches/reinout_distribute_upgrade_check
This is the fix for an infinite recursion when updating Distribute.
Solved by using the available setuptools/distribute for easy_installing the Distribute tgz instead of searching for it, which tries to install, which searches...

git-svn-id: http://svn.zope.org/repos/main/zc.buildout/trunk@105585 62d5b8a3-27da-0310-9561-8e5933582275
parent 17788366
......@@ -4,7 +4,13 @@ Change History
1.4.3 (?)
=========
Bugs fixed:
- Using pre-detected setuptools version for easy_installing tgz files. This
prevents a recursion error when easy_installing an upgraded "distribute"
tgz. Note that setuptools did not have this recursion problem solely
because it was packaged as an ``.egg``, which does not have to go through
the easy_install step.
1.4.2 (2009-11-01)
......
......@@ -299,10 +299,7 @@ class Installer:
tmp = tempfile.mkdtemp(dir=dest)
try:
path = self._get_dist(
self._constrain(pkg_resources.Requirement.parse('setuptools')),
ws, False,
)[0].location
path = setuptools_loc
args = ('-c', _easy_install_cmd, '-mUNxd', _safe_arg(tmp))
if self._always_unzip:
......
......@@ -1208,7 +1208,6 @@ Now, if we install demo, and extdemo:
GET 200 /demo-0.2-py2.4.egg
GET 404 /index/demoneeded/
GET 200 /demoneeded-1.1.zip
GET 404 /index/setuptools/
>>> zc.buildout.easy_install.build(
... 'extdemo', dest,
......@@ -1251,7 +1250,6 @@ Now when we install the distributions:
GET 404 /index/demo/
GET 200 /index/
GET 404 /index/demoneeded/
GET 404 /index/setuptools/
>>> zc.buildout.easy_install.build(
... 'extdemo', dest,
......
......@@ -2921,7 +2921,7 @@ def test_suite():
doctest.DocFileSuite(
'easy_install.txt', 'downloadcache.txt', 'dependencylinks.txt',
'allowhosts.txt', 'unzip.txt',
'allowhosts.txt', 'unzip.txt', 'upgrading_distribute.txt',
setUp=easy_install_SetUp,
tearDown=zc.buildout.testing.buildoutTearDown,
checker=renormalizing.RENormalizing([
......
Installing setuptools/distribute
--------------------------------
Some initial test setup:
>>> import sys
>>> import zc.buildout.easy_install
>>> dest = tmpdir('sample-install')
Setuptools (0.6something) is packaged as an ``.egg``. So when installing it,
the egg is downloaded and used. Distribute is packaged as a tarball, which
makes an easy_install call necessary. In older versions of buildout, the
``_call_easy_install()`` method would call ``_get_dist()`` to get hold of the
setuptools path for calling easy_install. When an updated "distribute" was
found, this would try an install again, leading to an infinite recursion.
The solution is to just use the setuptools location found at import time, like
happens with the buildout and setuptools location that is inserted in scripts'
paths.
We test this corner case by patching the ``_get_dist()`` call:
>>> def mock_get_dist(requirement, ws, always_unzip):
... raise RuntimeError("We should not get called")
When installing setuptools itself, we expect the "Getting dist" message not to
be printed. We call ``_call_easy_install()`` directly and get an error
because of a non-existing tarball, but that's the OK for this corner case
test: we only want to test that ``_get_dist()`` isn't getting called:
>>> installer = zc.buildout.easy_install.Installer(
... dest=dest,
... links=[link_server],
... index=link_server+'index/',
... executable=sys.executable,
... always_unzip=True)
>>> installer._get_dist = mock_get_dist
>>> installer._call_easy_install('setuptools', None, dest,
... 'nonexisting.tgz')
Traceback (most recent call last):
...
UserError: Couldn't install: nonexisting.tgz
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