Add forbid-download-cache parameter

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