do not fail if autocmake.cfg exists

This commit is contained in:
Radovan Bast 2015-05-23 10:57:25 +02:00
parent f79cff740f
commit d72fefd327

View File

@ -18,7 +18,7 @@ class URLopener(urllib.FancyURLopener):
sys.exit(-1) sys.exit(-1)
def fetch_url(src, dst, fail_if_dst_exists=False): def fetch_url(src, dst):
""" """
Fetch file from URL src and save it to dst. Fetch file from URL src and save it to dst.
""" """
@ -27,11 +27,6 @@ def fetch_url(src, dst, fail_if_dst_exists=False):
if not os.path.isdir(dirname): if not os.path.isdir(dirname):
os.makedirs(dirname) os.makedirs(dirname)
if os.path.isfile(dst):
if fail_if_dst_exists:
sys.stderr.write("ERROR: %s already exists - aborting\n" % dst)
sys.exit(-1)
opener = URLopener() opener = URLopener()
opener.retrieve(src, dst) opener.retrieve(src, dst)
@ -263,12 +258,12 @@ def main(argv):
if argv[1] == '--init': if argv[1] == '--init':
# empty project, create infrastructure files # empty project, create infrastructure files
print('- fetching example autocmake.cfg') if not os.path.isfile('autocmake.cfg'):
fetch_url( print('- fetching example autocmake.cfg')
src='%s/raw/master/example/autocmake.cfg' % AUTOCMAKE_GITHUB_URL, fetch_url(
dst='autocmake.cfg', src='%s/raw/master/example/autocmake.cfg' % AUTOCMAKE_GITHUB_URL,
fail_if_dst_exists=True dst='autocmake.cfg'
) )
print('- fetching lib/config.py') print('- fetching lib/config.py')
fetch_url( fetch_url(
src='%s/raw/master/lib/config.py' % AUTOCMAKE_GITHUB_URL, src='%s/raw/master/lib/config.py' % AUTOCMAKE_GITHUB_URL,