diff options
author | Thibault Saunier <tsaunier@igalia.com> | 2018-03-28 11:24:32 -0300 |
---|---|---|
committer | Thibault Saunier <tsaunier@igalia.com> | 2018-03-28 11:25:38 -0300 |
commit | 6ff7fadbeaa3c499dc690cf703c22aede03a63c2 (patch) | |
tree | 380402ab1780686bd82f242238ad80ea600d2b80 | |
parent | 86581adae9cb3929b8dad0b94cee6585697ebf4f (diff) |
Checkout the right repo1.12
And make the file pep8 compliant
-rw-r--r-- | testsuites/testsuiteutils.py | 17 |
1 files changed, 12 insertions, 5 deletions
diff --git a/testsuites/testsuiteutils.py b/testsuites/testsuiteutils.py index 078cbce..6a5efc6 100644 --- a/testsuites/testsuiteutils.py +++ b/testsuites/testsuiteutils.py @@ -33,6 +33,8 @@ except ImportError: last_message_length = 0 + + def message(string): global last_message_length print('\r' + string + ' ' * max(0, last_message_length - len(string)), end='') @@ -40,7 +42,7 @@ def message(string): def sizeof_fmt(num, suffix='B'): - for unit in ['','Ki','Mi','Gi','Ti','Pi','Ei','Zi']: + for unit in ['', 'Ki', 'Mi', 'Gi', 'Ti', 'Pi', 'Ei', 'Zi']: if abs(num) < 1024.0: return "%3.1f%s%s" % (num, unit, suffix) num /= 1024.0 @@ -48,18 +50,21 @@ def sizeof_fmt(num, suffix='B'): URL = "" + + def reporthook(blocknum, blocksize, totalsize): global URL readsofar = blocknum * blocksize if totalsize > 0: percent = readsofar * 1e2 / totalsize s = "\r%s —%5.1f%% %s / %s" % (URL, - percent, sizeof_fmt(readsofar), sizeof_fmt(totalsize)) \ + percent, sizeof_fmt(readsofar), sizeof_fmt(totalsize)) \ + ' ' * 50 message(s) - else: # total size is unknown + else: # total size is unknown message("read %d" % (readsofar,)) + def download_files(assets_dir): print("Downloading %s" % assets_dir if assets_dir else "all assets") fdir = os.path.abspath(os.path.join(os.path.dirname(os.path.abspath(__file__)), @@ -80,7 +85,8 @@ def download_files(assets_dir): os.makedirs(os.path.dirname(fname), exist_ok=True) rpath = fname[len(fdir) + 1:] global URL - URL = 'https://gstreamer.freedesktop.org/data/media/gst-integration-testsuite/' + quote(rpath) + URL = 'https://gstreamer.freedesktop.org/data/media/gst-integration-testsuite/' + \ + quote(rpath) message("\rDownloading %s" % URL) try: @@ -102,7 +108,8 @@ def update_assets(options, assets_dir): GST_VALIDATE_TESTSUITE_VERSION, GST_VALIDATE_TESTSUITE_VERSION) if options.force_sync: subprocess.check_call(["git", "reset", "--hard"]) - subprocess.check_call(CHECKOUT_BRANCH_COMMAND, shell=True) + print("Checking out %s" % GST_VALIDATE_TESTSUITE_VERSION) + subprocess.check_call(CHECKOUT_BRANCH_COMMAND, shell=True, cwd=assets_dir) download_files(os.path.basename(os.path.join(assets_dir))) except Exception as e: print("\nERROR: Could not update assets \n\n%s" |