]> git.ipfire.org Git - thirdparty/babel.git/commitdiff
Quiesce CLDR download progress bar if requested (or not a TTY)
authorAarni Koskela <akx@iki.fi>
Wed, 11 Nov 2020 13:24:16 +0000 (15:24 +0200)
committerAarni Koskela <akx@iki.fi>
Thu, 12 Nov 2020 09:41:31 +0000 (11:41 +0200)
scripts/download_import_cldr.py

index 531a04c62a790bbaafaad95287061a1d4a2d63dc..805772a1648c2c4aca557bbb11ba7d1b30965d1f 100755 (executable)
@@ -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')