Add --no-download to disable the downloader.

This commit is contained in:
Chris Johns
2013-04-15 09:18:31 +10:00
parent cc2c48ba88
commit 5e02e80d5a
3 changed files with 43 additions and 30 deletions

View File

@@ -128,11 +128,13 @@ class build:
def get_file(self, url, local):
if local is None:
raise error.general('source/patch path invalid')
if not path.isdir(path.dirname(local)):
if not path.isdir(path.dirname(local)) and not self.opts.download_disabled():
_notice(self.opts,
'Creating source directory: %s' % (os.path.relpath(path.host(path.dirname(local)))))
self.mkdir(path.host(path.dirname(local)))
if not path.exists(local):
if self.opts.download_disabled():
raise error.general('source not found: %s' % (path.host(local)))
#
# Not localy found so we need to download it. Check if a URL has
# been provided on the command line.