Commit 268402c1 authored by Jim Fulton's avatar Jim Fulton

Fixed bug:

When using a local find links or index, distributions weren't copied
 to the download cache.
parent e8608be7
......@@ -24,6 +24,9 @@ Bugs Fixed
- 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)
=====================
......
......@@ -400,8 +400,23 @@ class Installer:
best.sort()
return best[-1]
def _fetch(self, dist, tmp):
return dist.clone(location=self._index.download(dist.location, tmp))
def _fetch(self, dist, tmp, download_cache):
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):
......@@ -424,15 +439,11 @@ class Installer:
sys.path_importer_cache.clear()
tmp = self._download_cache
try:
if tmp:
if os.path.dirname(avail.location) == tmp:
dist = avail
else:
dist = self._fetch(avail, tmp)
else:
if tmp is None:
tmp = tempfile.mkdtemp('get_dist')
dist = self._fetch(avail, tmp)
try:
dist = self._fetch(avail, tmp, self._download_cache)
if dist is None:
raise zc.buildout.UserError(
......@@ -626,15 +637,11 @@ class Installer:
logger.debug('Building %r', spec)
tmp = self._download_cache
try:
if tmp:
if os.path.dirname(avail.location) == tmp:
dist = avail
else:
dist = self._fetch(avail, tmp)
else:
if tmp is None:
tmp = tempfile.mkdtemp('get_dist')
dist = self._fetch(avail, tmp)
try:
dist = self._fetch(avail, tmp, self._download_cache)
build_tmp = tempfile.mkdtemp('build')
try:
......
......@@ -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):
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