From: Aarni Koskela Date: Wed, 11 Nov 2020 13:24:16 +0000 (+0200) Subject: Quiesce CLDR download progress bar if requested (or not a TTY) X-Git-Tag: v2.9.1~3^2~2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=156b7fb9f377ccf58c71cf01dc69fb10c7b69314;p=thirdparty%2Fbabel.git Quiesce CLDR download progress bar if requested (or not a TTY) --- diff --git a/scripts/download_import_cldr.py b/scripts/download_import_cldr.py index 531a04c6..805772a1 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')