diff options
author | thakis@chromium.org <thakis@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-12-20 17:38:16 +0000 |
---|---|---|
committer | thakis@chromium.org <thakis@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-12-20 17:38:16 +0000 |
commit | 5a4defe8bda0efdfadf497d63bd9d0948e82d294 (patch) | |
tree | e7bad3a21d6b3bd18fd478185f6ab0e38cca6eed /build | |
parent | 436cfae49afa3049abcb32dd212c11bf0b20f290 (diff) | |
download | chromium_src-5a4defe8bda0efdfadf497d63bd9d0948e82d294.zip chromium_src-5a4defe8bda0efdfadf497d63bd9d0948e82d294.tar.gz chromium_src-5a4defe8bda0efdfadf497d63bd9d0948e82d294.tar.bz2 |
Let build-bisect.py print download progress.
BUG=None
TEST=run build-bisect.py while riding the shuttle, feel reassured by progress bar
Review URL: http://codereview.chromium.org/6024005
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@69723 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'build')
-rwxr-xr-x | build/build-bisect.py | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/build/build-bisect.py b/build/build-bisect.py index 84807bc..c081236 100755 --- a/build/build-bisect.py +++ b/build/build-bisect.py @@ -138,9 +138,21 @@ def TryRevision(rev, profile, args): # Download the file. download_url = BUILD_BASE_URL + (BUILD_ARCHIVE_URL % rev) + BUILD_ZIP_NAME + def _Reporthook(blocknum, blocksize, totalsize): + size = blocknum * blocksize + if totalsize == -1: # Total size not known. + progress = "Received %d bytes" % size + else: + size = min(totalsize, size) + progress = "Received %d of %d bytes, %.2f%%" % ( + size, totalsize, 100.0 * size / totalsize) + # Send a \r to let all progress messages use just one line of output. + sys.stdout.write("\r" + progress) + sys.stdout.flush() try: print 'Fetching ' + download_url - urllib.urlretrieve(download_url, BUILD_ZIP_NAME) + urllib.urlretrieve(download_url, BUILD_ZIP_NAME, _Reporthook) + print except Exception, e: print('Could not retrieve the download. Sorry.') sys.exit(-1) |