aboutsummaryrefslogtreecommitdiffstats
path: root/host/utils
diff options
context:
space:
mode:
authorMartin Braun <martin.braun@ettus.com>2018-10-29 16:02:53 -0700
committerBrent Stapleton <bstapleton@g.hmc.edu>2018-11-13 12:12:09 -0800
commite360bc99420e5f5ae9a5caa9d47f19e50edbea61 (patch)
tree86cc7aa560f0f0727c5c75976e9e0f1a9d2fdc70 /host/utils
parentc95f8d9107ace0459946dd52efb604acff6a4880 (diff)
downloaduhd-e360bc99420e5f5ae9a5caa9d47f19e50edbea61.tar.gz
uhd-e360bc99420e5f5ae9a5caa9d47f19e50edbea61.tar.bz2
uhd-e360bc99420e5f5ae9a5caa9d47f19e50edbea61.zip
utils: Allow downloader to ship non-zip files
Note: All archives shipped using this tool are zip files. However, this allows us to ship other types of files, which will be downloaded and sorted into the images directory as-is.
Diffstat (limited to 'host/utils')
-rw-r--r--host/utils/uhd_images_downloader.py.in18
1 files changed, 13 insertions, 5 deletions
diff --git a/host/utils/uhd_images_downloader.py.in b/host/utils/uhd_images_downloader.py.in
index 11f8ad39b..48f444d45 100644
--- a/host/utils/uhd_images_downloader.py.in
+++ b/host/utils/uhd_images_downloader.py.in
@@ -462,12 +462,20 @@ def main():
# Otherwise, the check has succeeded, and we can proceed
delete_from_inv(target_info, inventory, images_dir)
- archive_namelist = extract(temp_path, images_dir, archive_type, args.test)
- if args.keep:
- # If the user wants to keep the downloaded archive,
- # save it to the images directory and add it to the inventory
+ if os.path.splitext(temp_path)[1].lower() == '.zip':
+ archive_namelist = extract(
+ temp_path,
+ images_dir,
+ archive_type,
+ args.test)
+ if args.keep:
+ # If the user wants to keep the downloaded archive,
+ # save it to the images directory and add it to the inventory
+ shutil.copy(temp_path, images_dir)
+ archive_namelist.append(filename)
+ else:
+ archive_namelist = []
shutil.copy(temp_path, images_dir)
- archive_namelist.append(filename)
inventory[target_name] = {"repo_hash": target_hash,
"contents": archive_namelist,
"filename": filename}