mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Retry vendored dependency download failures on CI
GitHub Actions is getting insanely flaky
This commit is contained in:
parent
bc8d76cfef
commit
8eca4d7ced
@ -2,13 +2,16 @@
|
|||||||
# vim:fileencoding=utf-8
|
# vim:fileencoding=utf-8
|
||||||
# License: GPL v3 Copyright: 2019, Eli Schwartz <eschwartz@archlinux.org>
|
# License: GPL v3 Copyright: 2019, Eli Schwartz <eschwartz@archlinux.org>
|
||||||
|
|
||||||
import os, shutil
|
import os
|
||||||
from io import BytesIO
|
import shutil
|
||||||
import tarfile
|
import tarfile
|
||||||
|
import time
|
||||||
|
from io import BytesIO
|
||||||
|
|
||||||
from setup import Command, download_securely
|
from setup import Command, download_securely
|
||||||
|
|
||||||
|
is_ci = os.environ.get('CI', '').lower() == 'true'
|
||||||
|
|
||||||
|
|
||||||
class ReVendor(Command):
|
class ReVendor(Command):
|
||||||
|
|
||||||
@ -25,7 +28,14 @@ class ReVendor(Command):
|
|||||||
|
|
||||||
def download_vendor_release(self, tdir, url):
|
def download_vendor_release(self, tdir, url):
|
||||||
self.info('Downloading %s:' % self.TAR_NAME, url)
|
self.info('Downloading %s:' % self.TAR_NAME, url)
|
||||||
raw = download_securely(url)
|
try:
|
||||||
|
raw = download_securely(url)
|
||||||
|
except Exception:
|
||||||
|
if not is_ci:
|
||||||
|
raise
|
||||||
|
self.info('Download failed, sleeping and retrying...')
|
||||||
|
time.sleep(2)
|
||||||
|
raw = download_securely(url)
|
||||||
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:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user