From fe387470665c5eeccbbf927353a2b368682b34df Mon Sep 17 00:00:00 2001 From: Wade Fife Date: Tue, 19 Apr 2022 10:51:28 -0500 Subject: 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. --- host/utils/uhd_images_downloader.py.in | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'host') 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( -- cgit v1.2.3