[travis] Retry. (#221)

This commit is contained in:
scturtle 2018-01-03 14:25:06 +08:00 committed by Fangrui Song
parent c8040a3b9e
commit f23a79b01d
2 changed files with 5 additions and 11 deletions

View File

@ -32,7 +32,7 @@ os: linux
cache: cache:
directories: directories:
- build/clang+llvm-5.0.1-x86_64-linux-gnu-ubuntu-14.04/ - build/clang+llvm-5.0.1-x86_64-linux-gnu-ubuntu-14.04/
- build/clang+llvm-5.0.1-final-x86_64-apple-darwin/ - build/clang+llvm-5.0.1-x86_64-apple-darwin/
matrix: matrix:
fast_finish: true fast_finish: true
@ -193,7 +193,7 @@ before_script:
- ${CXX} --version - ${CXX} --version
script: script:
- ./waf configure - travis_retry ./waf configure
- ./waf build - ./waf build
- ./build/release/bin/cquery --log-all-to-stderr --test-unit - ./build/release/bin/cquery --log-all-to-stderr --test-unit
- ./build/release/bin/cquery --log-all-to-stderr --test-index - ./build/release/bin/cquery --log-all-to-stderr --test-index

12
wscript
View File

@ -2,9 +2,9 @@
# encoding: utf-8 # encoding: utf-8
try: try:
from urllib2 import urlopen, URLError # Python 2 from urllib2 import urlopen # Python 2
except ImportError: except ImportError:
from urllib.request import urlopen, URLError # Python 3 from urllib.request import urlopen # Python 3
import os.path import os.path
import string import string
@ -100,13 +100,7 @@ def download_and_extract(destdir, url, ext):
print(' destination: {0}'.format(dest)) print(' destination: {0}'.format(dest))
print(' source: {0}'.format(url)) print(' source: {0}'.format(url))
# TODO: verify checksum # TODO: verify checksum
for _ in range(5): response = urlopen(url, timeout=60)
try:
response = urlopen(url, timeout=60)
break
except URLError:
print('Retry')
continue
with open(dest, 'wb') as f: with open(dest, 'wb') as f:
f.write(response.read()) f.write(response.read())
else: else: