Skip to content
Snippets Groups Projects
Commit fd805d81 authored by Roel Aaij's avatar Roel Aaij Committed by Christopher Rob Jones
Browse files

Insert hash of downloaded MDF files before the extension instead of at the beginning

parent 3cbb2aaf
No related branches found
No related tags found
3 merge requests!4232Run5: rebase, restructure run5 code, add back examples,!3700Synchronize master branch with 2024-patches,!3521Insert hash of downloaded MDF files before the extension instead of at the beginning
Pipeline #7812762 passed
......@@ -111,12 +111,15 @@ def download_inputs_locally(urls, dest_dir, assertion_endswith, max_size=None):
url = url[4:]
if url not in local_files:
# prepend hash of full URL in case basenames are not unique
basename = '{}_{}'.format(
hashlib.md5(url.encode()).hexdigest(), os.path.basename(url))
basename = os.path.basename(url)
assertion = 0
for ending in assertion_endswith:
assertion += basename.endswith(ending)
assert assertion
stem, ext = os.path.splitext(basename)
basename = '{}_{}{}'.format(stem,
hashlib.md5(url.encode()).hexdigest(),
ext)
dest = os.path.join(dest_dir, basename)
src_size = xrd_size(url)
......@@ -158,7 +161,7 @@ def download_inputs_locally(urls, dest_dir, assertion_endswith, max_size=None):
def download_digi_inputs_locally(urls, dest_dir, max_size=None):
"""
Calls download_inputs_locally specifically for digi or xdigi files.
Calls download_inputs_locally specifically for digi or xdigi files.
"""
assertion_endswith = ['.digi', '.xdigi']
return download_inputs_locally(
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment