Skip to content

Commit 156b7fb

Browse files
committed
Quiesce CLDR download progress bar if requested (or not a TTY)
1 parent 613dc17 commit 156b7fb

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

scripts/download_import_cldr.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,12 +75,13 @@ def main():
7575
cldr_path = os.path.join(repo, 'cldr', os.path.splitext(FILENAME)[0])
7676
zip_path = os.path.join(cldr_dl_path, FILENAME)
7777
changed = False
78+
show_progress = (False if os.environ.get("BABEL_CLDR_NO_DOWNLOAD_PROGRESS") else sys.stdout.isatty())
7879

7980
while not is_good_file(zip_path):
8081
log('Downloading \'%s\'', FILENAME)
8182
if os.path.isfile(zip_path):
8283
os.remove(zip_path)
83-
urlretrieve(URL, zip_path, reporthook)
84+
urlretrieve(URL, zip_path, (reporthook if show_progress else None))
8485
changed = True
8586
print()
8687
common_path = os.path.join(cldr_path, 'common')

0 commit comments

Comments
 (0)