From a5b5d358fbeed00b43d3c83c4beb926b339f9727 Mon Sep 17 00:00:00 2001 From: Andreas Tolfsen Date: Thu, 18 Sep 2014 12:16:49 +0100 Subject: Support dumb terminals in bootstrap downloads Dumb terminals can only interpret a limited number of control codes, and rewriting the terminal buffer will make `./mach build` very talkative on these terminals. This can be tested by setting the environment variable TERM to "dumb" as such: TERM=dumb ./mach build --- python/servo/bootstrap_commands.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'python/servo/bootstrap_commands.py') diff --git a/python/servo/bootstrap_commands.py b/python/servo/bootstrap_commands.py index 13a411f7008..bf83803afac 100644 --- a/python/servo/bootstrap_commands.py +++ b/python/servo/bootstrap_commands.py @@ -47,8 +47,11 @@ def download(desc, src, dst): print("\rDownloading %s: %5.1f%%" % (desc, pct), end="") sys.stdout.flush() - urllib.urlretrieve(src, dst, report) - print() + print("Downloading %s..." % desc) + dumb = os.environ.get("TERM") == "dumb" + urllib.urlretrieve(src, dst, None if dumb else report) + if not dumb: + print() def extract(src, dst, movedir=None): tarfile.open(src).extractall(dst) -- cgit v1.2.3