aboutsummaryrefslogtreecommitdiffstats
path: root/host/utils/uhd_images_downloader.py.in
diff options
context:
space:
mode:
authorWade Fife <wade.fife@ettus.com>2022-04-19 10:51:28 -0500
committerAaron Rossetto <aaron.rossetto@ni.com>2022-06-10 13:24:04 -0500
commitfe387470665c5eeccbbf927353a2b368682b34df (patch)
tree206506c258e2608b66aee0339d22c4654aec54de /host/utils/uhd_images_downloader.py.in
parent1cdbc89050fd5783e7f926355f97361690a635f6 (diff)
downloaduhd-fe387470665c5eeccbbf927353a2b368682b34df.tar.gz
uhd-fe387470665c5eeccbbf927353a2b368682b34df.tar.bz2
uhd-fe387470665c5eeccbbf927353a2b368682b34df.zip
utils: uhd_images_downloader: Print name of file that exceeds limit
When a file exceeds the download limit, print the name of the file in the message that asks if we want to continue downloading.
Diffstat (limited to 'host/utils/uhd_images_downloader.py.in')
-rw-r--r--host/utils/uhd_images_downloader.py.in10
1 files changed, 5 insertions, 5 deletions
diff --git a/host/utils/uhd_images_downloader.py.in b/host/utils/uhd_images_downloader.py.in
index b9bc2dd0b..b45470650 100644
--- a/host/utils/uhd_images_downloader.py.in
+++ b/host/utils/uhd_images_downloader.py.in
@@ -395,19 +395,19 @@ def download(
if resp.status_code != 200:
raise RuntimeError("URL does not exist: {}".format(images_url))
filesize = float(resp.headers.get('content-length', -1))
+ base_filename = os.path.basename(filename)
if filesize > download_limit:
if not ask_permission(
- "The file size for this target ({:.1f} MiB) exceeds the "
+ "The file size for {} ({:.1f} MiB) exceeds the "
"download limit ({:.1f} MiB). Continue downloading?".format(
- filesize/1024**2, download_limit/1024**2)):
+ base_filename, filesize/1024**2, download_limit/1024**2)):
return 0, 0, ""
if filesize == -1:
if not ask_permission(
- "The file size for this target could not be determined. "
- "Continue downloading?"):
+ "The file size for {} could not be determined. "
+ "Continue downloading?".format(base_filename)):
return 0, 0, ""
filesize_dl = 0
- base_filename = os.path.basename(filename)
if print_progress and not sys.stdout.isatty():
print_progress = False
log("INFO", "Downloading {}, total size: {} kB".format(