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
This commit is contained in:
Andreas Tolfsen 2014-09-18 12:16:49 +01:00
parent 340ebdfd85
commit a5b5d358fb

View file

@ -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)