Add forbid-download-cache parameter

parent 74c33409
...@@ -126,10 +126,13 @@ class Recipe(object): ...@@ -126,10 +126,13 @@ class Recipe(object):
self.name = name self.name = name
self.location = options.get('location', self.location = options.get('location',
os.path.join(buildout['buildout']['parts-directory'], name)) os.path.join(buildout['buildout']['parts-directory'], name))
if options.get('develop') in TRUE_VALUES: # Set boolean values
self.develop = True for key in ['develop', 'forbid-download-cache']:
attribute = key.replace('-', '_')
if options.get(key) in TRUE_VALUES:
setattr(self, attribute, True)
else: else:
self.develop = False setattr(self, attribute, False)
self.networkcache = buildout.get('networkcache', {}) self.networkcache = buildout.get('networkcache', {})
...@@ -179,10 +182,12 @@ class Recipe(object): ...@@ -179,10 +182,12 @@ class Recipe(object):
except CalledProcessError: except CalledProcessError:
print ("Unable to download from git repository. Trying from network " print ("Unable to download from git repository. Trying from network "
"cache...") "cache...")
if not download_network_cached(self.location, self.name, self.revision,
self.networkcache):
if os.path.exists(self.location): if os.path.exists(self.location):
shutil.rmtree(self.location) shutil.rmtree(self.location)
if self.forbid_download_cache:
raise UserError('Impossible to clone repository.')
if not download_network_cached(self.location, self.name, self.revision,
self.networkcache):
raise UserError('Impossible to clone repository and impossible to ' raise UserError('Impossible to clone repository and impossible to '
'download from cache.') 'download from cache.')
......
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