Commit e1df3174 authored by jim's avatar jim

Fixed bug:

When using a local find links or index, distributions weren't copied
 to the download cache.


git-svn-id: http://svn.zope.org/repos/main/zc.buildout/trunk@81175 62d5b8a3-27da-0310-9561-8e5933582275
parent d48d5661
...@@ -24,6 +24,9 @@ Bugs Fixed ...@@ -24,6 +24,9 @@ Bugs Fixed
- The setup command raised a stupid exception if run without arguments. - The setup command raised a stupid exception if run without arguments.
- When using a local find links or index, distributions weren't copied
to the download cache.
1.0.0b30 (2007-08-20) 1.0.0b30 (2007-08-20)
===================== =====================
......
...@@ -400,8 +400,23 @@ class Installer: ...@@ -400,8 +400,23 @@ class Installer:
best.sort() best.sort()
return best[-1] return best[-1]
def _fetch(self, dist, tmp): def _fetch(self, dist, tmp, download_cache):
return dist.clone(location=self._index.download(dist.location, tmp)) if (download_cache
and (os.path.dirname(dist.location) == download_cache)
):
return dist
new_location = self._index.download(dist.location, tmp)
if (download_cache
and (new_location == dist.location)
and os.path.isfile(new_location)
):
# setuptools avoids making extra copies, but we want to copy
# to the download cache
shutil.copy2(new_location, tmp)
new_location = os.path.join(tmp, os.path.basename(new_location))
return dist.clone(location=new_location)
def _get_dist(self, requirement, ws, always_unzip): def _get_dist(self, requirement, ws, always_unzip):
...@@ -424,15 +439,11 @@ class Installer: ...@@ -424,15 +439,11 @@ class Installer:
sys.path_importer_cache.clear() sys.path_importer_cache.clear()
tmp = self._download_cache tmp = self._download_cache
try: if tmp is None:
if tmp:
if os.path.dirname(avail.location) == tmp:
dist = avail
else:
dist = self._fetch(avail, tmp)
else:
tmp = tempfile.mkdtemp('get_dist') tmp = tempfile.mkdtemp('get_dist')
dist = self._fetch(avail, tmp)
try:
dist = self._fetch(avail, tmp, self._download_cache)
if dist is None: if dist is None:
raise zc.buildout.UserError( raise zc.buildout.UserError(
...@@ -626,15 +637,11 @@ class Installer: ...@@ -626,15 +637,11 @@ class Installer:
logger.debug('Building %r', spec) logger.debug('Building %r', spec)
tmp = self._download_cache tmp = self._download_cache
try: if tmp is None:
if tmp:
if os.path.dirname(avail.location) == tmp:
dist = avail
else:
dist = self._fetch(avail, tmp)
else:
tmp = tempfile.mkdtemp('get_dist') tmp = tempfile.mkdtemp('get_dist')
dist = self._fetch(avail, tmp)
try:
dist = self._fetch(avail, tmp, self._download_cache)
build_tmp = tempfile.mkdtemp('build') build_tmp = tempfile.mkdtemp('build')
try: try:
......
...@@ -2056,6 +2056,36 @@ directory and then use the wacky extension to load the demo package ...@@ -2056,6 +2056,36 @@ directory and then use the wacky extension to load the demo package
""" """
def distributions_from_local_find_links_make_it_to_download_cache():
"""
If we specify a local directory in find links, distors found there
need to make it to the download cache.
>>> mkdir('test')
>>> write('test', 'setup.py',
... '''
... from setuptools import setup
... setup(name='foo')
... ''')
>>> print system(buildout+' setup test bdist_egg'), # doctest: +ELLIPSIS
Running setup script 'test/setup.py'.
...
>>> mkdir('cache')
>>> old_cache = zc.buildout.easy_install.download_cache('cache')
>>> list(zc.buildout.easy_install.install(['foo'], 'eggs',
... links=[join('test', 'dist')])) # doctest: +ELLIPSIS
[foo 0.0.0 ...
>>> ls('cache')
- foo-0.0.0-py2.4.egg
>>> _ = zc.buildout.easy_install.download_cache(old_cache)
"""
def create_egg(name, version, dest): def create_egg(name, version, dest):
d = tempfile.mkdtemp() d = tempfile.mkdtemp()
......
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