Commit ca0599e3 authored by Lucas Carvalho's avatar Lucas Carvalho

Removed useless import.

parent ce3baeea
...@@ -40,8 +40,7 @@ class ChecksumError(zc.buildout.UserError): ...@@ -40,8 +40,7 @@ class ChecksumError(zc.buildout.UserError):
url_opener = URLOpener() url_opener = URLOpener()
from zc.buildout.networkcache import get_sha256sum_from_networkcached, \ from zc.buildout.networkcache import download_network_cached, \
download_network_cached, \
upload_network_cached upload_network_cached
...@@ -180,6 +179,8 @@ class Download(object): ...@@ -180,6 +179,8 @@ class Download(object):
self.logger.info('Downloading %s' % url) self.logger.info('Downloading %s' % url)
urllib._urlopener = url_opener urllib._urlopener = url_opener
handle, tmp_path = tempfile.mkstemp(prefix='buildout-') handle, tmp_path = tempfile.mkstemp(prefix='buildout-')
try:
try: try:
if not download_network_cached(self.network_cache, tmp_path, if not download_network_cached(self.network_cache, tmp_path,
url, self.logger): url, self.logger):
...@@ -192,15 +193,11 @@ class Download(object): ...@@ -192,15 +193,11 @@ class Download(object):
# Upload the file to networkcached. # Upload the file to networkcached.
upload_network_cached(self.network_cache, url, upload_network_cached(self.network_cache, url,
tmp_path, self.logger) tmp_path, self.logger)
except IOError, e:
os.remove(tmp_path)
raise zc.buildout.UserError("Error downloading extends for URL "
"%s: %r" % (url, e[1:3]))
except Exception, e:
os.remove(tmp_path)
raise
finally: finally:
os.close(handle) os.close(handle)
except:
os.remove(tmp_path)
raise
if path: if path:
shutil.move(tmp_path, path) shutil.move(tmp_path, path)
......
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