From 156b7fb9f377ccf58c71cf01dc69fb10c7b69314 Mon Sep 17 00:00:00 2001 From: Aarni Koskela Date: Wed, 11 Nov 2020 15:24:16 +0200 Subject: [PATCH] Quiesce CLDR download progress bar if requested (or not a TTY) --- scripts/download_import_cldr.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/scripts/download_import_cldr.py b/scripts/download_import_cldr.py index 531a04c62..805772a16 100755 --- a/scripts/download_import_cldr.py +++ b/scripts/download_import_cldr.py @@ -75,12 +75,13 @@ def main(): cldr_path = os.path.join(repo, 'cldr', os.path.splitext(FILENAME)[0]) zip_path = os.path.join(cldr_dl_path, FILENAME) changed = False + show_progress = (False if os.environ.get("BABEL_CLDR_NO_DOWNLOAD_PROGRESS") else sys.stdout.isatty()) while not is_good_file(zip_path): log('Downloading \'%s\'', FILENAME) if os.path.isfile(zip_path): os.remove(zip_path) - urlretrieve(URL, zip_path, reporthook) + urlretrieve(URL, zip_path, (reporthook if show_progress else None)) changed = True print() common_path = os.path.join(cldr_path, 'common')