mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-08 10:44:09 -04:00
Retry downloads on travis
Should hopefully work around the flakiness on the travis OS X machines where curl aborts in the middle of downloads when under load
This commit is contained in:
parent
8db0c710d8
commit
9c5815d9c0
@ -15,12 +15,12 @@ matrix:
|
||||
- os: osx
|
||||
env:
|
||||
# On OS X the frameworks/dylibs contain hard coded paths, so we have to re-create the paths in the VM exactly
|
||||
- SWBASE=/Users/kovid SW=$SWBASE/sw PATH=$SW/bin:$SW/qt/bin:$SW/python/Python.framework/Versions/2.7/bin:$PWD/node_modules/.bin:$PATH CFLAGS=-I$SW/include LDFLAGS=-L$SW/lib QMAKE=$SW/qt/bin/qmake QT_PLUGIN_PATH=$SW/qt/plugins
|
||||
- SWBASE=/Users/kovid SW=$SWBASE/sw PATH=$SW/bin:$SW/qt/bin:$SW/python/Python.framework/Versions/2.7/bin:$PWD/node_modules/.bin:$PATH CFLAGS=-I$SW/include LDFLAGS=-L$SW/lib QMAKE=$SW/qt/bin/qmake QT_PLUGIN_PATH=$SW/qt/plugins
|
||||
|
||||
before_install:
|
||||
- if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then curl https://download.calibre-ebook.com/travis/sw-linux.tar.xz | tar xJ -C $HOME; fi
|
||||
- if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then python setup/ci-download.py https://download.calibre-ebook.com/travis/sw-linux.tar.xz J $HOME; fi
|
||||
- if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then sudo mkdir -p $SWBASE && sudo chown $USER $SWBASE; fi
|
||||
- if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then curl https://download.calibre-ebook.com/travis/sw-osx.tar.bz2 | tar xj -C $SWBASE; fi
|
||||
- if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then python setup/ci-download.py https://download.calibre-ebook.com/travis/sw-osx.tar.bz2 j $SWBASE; fi
|
||||
- npm install --no-optional rapydscript-ng && echo $PATH && which rapydscript && rapydscript --version
|
||||
- python setup.py bootstrap --ephemeral
|
||||
- if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then export SSL_CERT_FILE=$PWD/resources/mozilla-ca-certs.pem; fi
|
||||
|
29
setup/ci-download.py
Normal file
29
setup/ci-download.py
Normal file
@ -0,0 +1,29 @@
|
||||
#!/usr/bin/env python
|
||||
# vim:fileencoding=utf-8
|
||||
# License: GPLv3 Copyright: 2017, Kovid Goyal <kovid at kovidgoyal.net>
|
||||
|
||||
from __future__ import absolute_import, division, print_function, unicode_literals
|
||||
|
||||
import sys, subprocess
|
||||
from tempfile import NamedTemporaryFile
|
||||
|
||||
url, compression, dest = sys.argv[-3:]
|
||||
|
||||
|
||||
def decompress(path):
|
||||
raise SystemExit(
|
||||
subprocess.Popen(['tar', 'x' + compression + 'f', path, '-C', dest]).wait()
|
||||
)
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
for i in range(5):
|
||||
if i:
|
||||
print('Failed to download', url, 'retrying...'.format(url))
|
||||
else:
|
||||
print('Downloading', url, '...')
|
||||
with NamedTemporaryFile() as f:
|
||||
ret = subprocess.Popen(['curl', url], stdout=f).wait()
|
||||
if ret == 0:
|
||||
decompress(f.name)
|
||||
break
|
Loading…
x
Reference in New Issue
Block a user