Commit fc93b800 authored by Edward Hervey's avatar Edward Hervey 🤘 Committed by Edward Hervey
Browse files

testsuiteutils: Reduce output on non-interactive runs

When run from a non-interactive shell, limit the outputted information.
Without this, just downloading the assets alone would create logs of
several megabytes
parent 7ccf698d
......@@ -36,9 +36,12 @@ last_message_length = 0
def message(string):
global last_message_length
print('\r' + string + ' ' * max(0, last_message_length - len(string)), end='')
last_message_length = len(string)
if sys.stdout.isatty():
global last_message_length
print('\r' + string + ' ' * max(0, last_message_length - len(string)), end='')
last_message_length = len(string)
else:
print(string)
def sizeof_fmt(num, suffix='B'):
......@@ -87,10 +90,14 @@ def download_files(assets_dir):
global URL
URL = 'https://gstreamer.freedesktop.org/data/media/gst-integration-testsuite/' + \
quote(rpath)
message("\rDownloading %s" % URL)
if sys.stdout.isatty():
message("\rDownloading %s" % URL)
hook = reporthook
else:
message("Downloading %s" % URL)
hook = None
try:
urlretrieve(URL, fname, reporthook)
urlretrieve(URL, fname, hook)
except:
print("\nCould not retieved %s" % URL)
raise
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment