aboutsummaryrefslogtreecommitdiffstats
path: root/host/utils
diff options
context:
space:
mode:
authorBrent Stapleton <brent.stapleton@ettus.com>2018-02-02 13:48:08 -0800
committerMartin Braun <martin.braun@ettus.com>2018-02-07 17:23:45 +0100
commit46327696655c7d1a191a5f2a0beae842691736e0 (patch)
tree84bfeb1277404d6e006891ed8338f3d98ecccbbc /host/utils
parentd9366ba7d4b72f9e277ca7055842160dd6d32256 (diff)
downloaduhd-46327696655c7d1a191a5f2a0beae842691736e0.tar.gz
uhd-46327696655c7d1a191a5f2a0beae842691736e0.tar.bz2
uhd-46327696655c7d1a191a5f2a0beae842691736e0.zip
utils: images downloader: default download print
Adding a message at the INFO log level (the default) to tell users that downloads have begun. Also added the filename being downloaded to the progress bars. Reviewed-by: Martin Braun <martin.braun@ettus.com>
Diffstat (limited to 'host/utils')
-rw-r--r--host/utils/uhd_images_downloader.py.in8
1 files changed, 5 insertions, 3 deletions
diff --git a/host/utils/uhd_images_downloader.py.in b/host/utils/uhd_images_downloader.py.in
index b42cbb31c..26715fcbe 100644
--- a/host/utils/uhd_images_downloader.py.in
+++ b/host/utils/uhd_images_downloader.py.in
@@ -194,14 +194,16 @@ def download(images_url, filename, buffer_size=_DEFAULT_BUFFER_SIZE, print_progr
filesize = float(resp.headers['content-length'])
filesize_dl = 0
with open(filename, "wb") as temp_file:
+ base_filename = os.path.basename(filename)
for buff in resp.iter_content(chunk_size=buffer_size):
if buff:
temp_file.write(buff)
filesize_dl += len(buff)
if print_progress:
- status = r"%05d kB / %05d kB (%03d%%)" % (
+ status = r"%05d kB / %05d kB (%03d%%) %s" % (
int(math.ceil(filesize_dl / 1000.)), int(math.ceil(filesize / 1000.)),
- int(math.ceil(filesize_dl * 100.) / filesize))
+ int(math.ceil(filesize_dl * 100.) / filesize),
+ base_filename)
if os.name == "nt":
status += chr(8) * (len(status) + 1)
else:
@@ -327,7 +329,7 @@ def main():
# Now download all the images archives into a temp directory
images_dir = args.install_location
log("INFO", "Images destination: {}".format(os.path.abspath(images_dir)))
- log("DEBUG", "Base URL of images: {}".format(args.base_url))
+ log("INFO", "Starting download. Run with -v to see download progress bars.")
for target_info in targets_info:
target_hash = target_info.get("repo_hash")
target_rel_url = target_info.get("url")