Fix unneccessary re-downloads when re-vendoring

This commit is contained in:
Kovid Goyal 2021-03-04 21:47:42 +05:30
parent d148e2da5f
commit 1967b3e95d
No known key found for this signature in database
GPG Key ID: 06BC317B515ACE7C

View File

@ -32,11 +32,11 @@ class ReVendor(Command):
for i in range(num): for i in range(num):
try: try:
raw = download_securely(url) raw = download_securely(url)
except Exception: except Exception as err:
if i == num - 1: if i == num - 1:
raise raise
self.info('Download failed, sleeping and retrying...') self.info(f'Download failed with error "{err}" sleeping and retrying...')
time.sleep(2) time.sleep(2)
with tarfile.open(fileobj=BytesIO(raw)) as tf: with tarfile.open(fileobj=BytesIO(raw)) as tf:
tf.extractall(tdir) tf.extractall(tdir)
if len(os.listdir(tdir)) == 1: if len(os.listdir(tdir)) == 1: