Commit 8002e491 authored by Lucas Carvalho's avatar Lucas Carvalho

ShaDir is also required.

parent aead0f51
...@@ -71,7 +71,8 @@ class Download(object): ...@@ -71,7 +71,8 @@ class Download(object):
self.fallback = fallback self.fallback = fallback
self.hash_name = hash_name self.hash_name = hash_name
self.logger = logger or logging.getLogger('zc.buildout') self.logger = logger or logging.getLogger('zc.buildout')
self.network_cache = options.get('network-cache') self.sha_dir = options.get('sha-dir')
self.sha_cache = options.get('sha-cache')
@property @property
def download_cache(self): def download_cache(self):
...@@ -177,8 +178,8 @@ class Download(object): ...@@ -177,8 +178,8 @@ class Download(object):
try: try:
try: try:
if not download_network_cached(self.network_cache, tmp_path, if not download_network_cached(self.sha_dir, self.sha_cache,
url, self.logger, md5sum): tmp_path, url, self.logger, md5sum):
# Download from original url # Download from original url
tmp_path, headers = urllib.urlretrieve(url, tmp_path) tmp_path, headers = urllib.urlretrieve(url, tmp_path)
...@@ -186,7 +187,7 @@ class Download(object): ...@@ -186,7 +187,7 @@ class Download(object):
raise ChecksumError( raise ChecksumError(
'MD5 checksum mismatch downloading %r' % url) 'MD5 checksum mismatch downloading %r' % url)
# Upload the file to networkcached. # Upload the file to networkcached.
upload_network_cached(self.network_cache, url, upload_network_cached(self.sha_cache, self.sha_dir, url,
tmp_path, self.logger) tmp_path, self.logger)
finally: finally:
os.close(handle) os.close(handle)
......
...@@ -338,7 +338,8 @@ class Installer: ...@@ -338,7 +338,8 @@ class Installer:
include_site_packages=None, include_site_packages=None,
allowed_eggs_from_site_packages=None, allowed_eggs_from_site_packages=None,
prefer_final=None, prefer_final=None,
network_cache=None, sha_dir=None,
sha_cache=None
): ):
self._dest = dest self._dest = dest
self._allow_hosts = allow_hosts self._allow_hosts = allow_hosts
...@@ -407,7 +408,8 @@ class Installer: ...@@ -407,7 +408,8 @@ class Installer:
if versions is not None: if versions is not None:
self._versions = versions self._versions = versions
self._network_cache = network_cache self._sha_dir = sha_dir
self._sha_cache = sha_cache
_allowed_eggs_from_site_packages_regex = None _allowed_eggs_from_site_packages_regex = None
def allow_site_package_egg(self, name): def allow_site_package_egg(self, name):
...@@ -710,10 +712,10 @@ class Installer: ...@@ -710,10 +712,10 @@ class Installer:
filename = get_filename_from_url(dist.location) filename = get_filename_from_url(dist.location)
new_location = os.path.join(tmp, filename) new_location = os.path.join(tmp, filename)
if not download_network_cached(self._network_cache, new_location, if not download_network_cached(self._sha_dir, self._sha_cache,
dist.location, logger): new_location, dist.location, logger):
new_location = self._index.download(dist.location, tmp) new_location = self._index.download(dist.location, tmp)
upload_network_cached(self._network_cache, upload_network_cached(self._sha_cache, self._sha_dir,
dist.location, new_location, logger) dist.location, new_location, logger)
if (download_cache if (download_cache
...@@ -1093,13 +1095,13 @@ def install(specs, dest, ...@@ -1093,13 +1095,13 @@ def install(specs, dest,
path=None, working_set=None, newest=True, versions=None, path=None, working_set=None, newest=True, versions=None,
use_dependency_links=None, allow_hosts=('*',), use_dependency_links=None, allow_hosts=('*',),
include_site_packages=None, allowed_eggs_from_site_packages=None, include_site_packages=None, allowed_eggs_from_site_packages=None,
prefer_final=None, network_cache=None): prefer_final=None, sha_dir=None, sha_cache=None):
installer = Installer( installer = Installer(
dest, links, index, executable, always_unzip, path, newest, dest, links, index, executable, always_unzip, path, newest,
versions, use_dependency_links, allow_hosts=allow_hosts, versions, use_dependency_links, allow_hosts=allow_hosts,
include_site_packages=include_site_packages, include_site_packages=include_site_packages,
allowed_eggs_from_site_packages=allowed_eggs_from_site_packages, allowed_eggs_from_site_packages=allowed_eggs_from_site_packages,
prefer_final=prefer_final, network_cache=network_cache) prefer_final=prefer_final, sha_dir=sha_dir, sha_cache=sha_cache)
return installer.install(specs, working_set) return installer.install(specs, working_set)
......
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