Skip to content

Commit

Permalink
Quiesce CLDR download progress bar if requested (or not a TTY)
Browse files Browse the repository at this point in the history
  • Loading branch information
akx committed Nov 12, 2020
1 parent 613dc17 commit 156b7fb
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion scripts/download_import_cldr.py
Original file line number Diff line number Diff line change
Expand Up @@ -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')
Expand Down

0 comments on commit 156b7fb

Please sign in to comment.