change fetch destination

This commit is contained in:
Radovan Bast 2015-10-01 17:37:34 +02:00
parent ed77160a1c
commit 5890d462fe

View File

@ -276,11 +276,13 @@ def fetch_modules(config, relative_path):
dst = os.path.join(download_directory, 'autocmake_%s' % module_name) dst = os.path.join(download_directory, 'autocmake_%s' % module_name)
fetch_url(src, dst) fetch_url(src, dst)
file_name = dst file_name = dst
fetch_dst_directory = download_directory
else: else:
if os.path.exists(src): if os.path.exists(src):
path = os.path.dirname(src) path = os.path.dirname(src)
name = module_name name = module_name
file_name = src file_name = src
fetch_dst_directory = path
else: else:
sys.stderr.write("ERROR: %s does not exist\n" % src) sys.stderr.write("ERROR: %s does not exist\n" % src)
sys.exit(-1) sys.exit(-1)
@ -291,7 +293,11 @@ def fetch_modules(config, relative_path):
config = prepend_or_set(config, section, 'docopt', config_docopt) config = prepend_or_set(config, section, 'docopt', config_docopt)
config = prepend_or_set(config, section, 'define', config_define) config = prepend_or_set(config, section, 'define', config_define)
config = prepend_or_set(config, section, 'export', config_export) config = prepend_or_set(config, section, 'export', config_export)
config = prepend_or_set(config, section, 'fetch', config_fetch) if config_fetch:
for src in config_fetch.split('\n'):
dst = os.path.join(fetch_dst_directory, os.path.basename(src))
fetch_url(src, dst)
modules.append(Module(path=path, name=name)) modules.append(Module(path=path, name=name))
i += 1 i += 1
print_progress_bar( print_progress_bar(
@ -301,6 +307,8 @@ def fetch_modules(config, relative_path):
width=30 width=30
) )
if config.has_option(section, 'fetch'): if config.has_option(section, 'fetch'):
# when we fetch directly from autocmake.cfg
# we download into downloaded/
for src in config.get(section, 'fetch').split('\n'): for src in config.get(section, 'fetch').split('\n'):
dst = os.path.join(download_directory, os.path.basename(src)) dst = os.path.join(download_directory, os.path.basename(src))
fetch_url(src, dst) fetch_url(src, dst)