Merge pull request #237 from Czaki/repeat_get_pip_download
Repeat get-pip download on fail
This commit is contained in:
@@ -50,7 +50,8 @@ def build(project_dir, output_dir, test_command, test_requires, test_extras, bef
|
|||||||
return subprocess.check_call(args, env=env, cwd=cwd, shell=shell)
|
return subprocess.check_call(args, env=env, cwd=cwd, shell=shell)
|
||||||
|
|
||||||
# get latest pip once and for all
|
# get latest pip once and for all
|
||||||
call(['curl', '-L', '-o', get_pip_script, get_pip_url])
|
|
||||||
|
call(['curl', '-L', '--retry', '3', '--retry-delay', '3', '-o', get_pip_script, get_pip_url])
|
||||||
|
|
||||||
for config in python_configurations:
|
for config in python_configurations:
|
||||||
# if this version of python isn't installed, get it from python.org and install
|
# if this version of python isn't installed, get it from python.org and install
|
||||||
|
|||||||
+14
-1
@@ -1,5 +1,6 @@
|
|||||||
from __future__ import print_function
|
from __future__ import print_function
|
||||||
import os, tempfile, subprocess, shutil, sys
|
import os, tempfile, subprocess, shutil, sys
|
||||||
|
from time import sleep
|
||||||
from collections import namedtuple
|
from collections import namedtuple
|
||||||
from glob import glob
|
from glob import glob
|
||||||
|
|
||||||
@@ -62,17 +63,29 @@ def build(project_dir, output_dir, test_command, test_requires, test_extras, bef
|
|||||||
print('+ ' + ' '.join(args))
|
print('+ ' + ' '.join(args))
|
||||||
args = ['cmd', '/E:ON', '/V:ON', '/C'] + args
|
args = ['cmd', '/E:ON', '/V:ON', '/C'] + args
|
||||||
return subprocess.check_call(' '.join(args), env=env, cwd=cwd)
|
return subprocess.check_call(' '.join(args), env=env, cwd=cwd)
|
||||||
|
|
||||||
def download(url, dest):
|
def download(url, dest):
|
||||||
print('+ Download ' + url + ' to ' + dest)
|
print('+ Download ' + url + ' to ' + dest)
|
||||||
dest_dir = os.path.dirname(dest)
|
dest_dir = os.path.dirname(dest)
|
||||||
if not os.path.exists(dest_dir):
|
if not os.path.exists(dest_dir):
|
||||||
os.makedirs(dest_dir)
|
os.makedirs(dest_dir)
|
||||||
response = urlopen(url)
|
repeat_num = 3
|
||||||
|
for i in range(repeat_num):
|
||||||
|
try:
|
||||||
|
response = urlopen(url)
|
||||||
|
except:
|
||||||
|
if i == repeat_num - 1:
|
||||||
|
raise
|
||||||
|
sleep(3)
|
||||||
|
continue
|
||||||
|
break
|
||||||
|
|
||||||
try:
|
try:
|
||||||
with open(dest, 'wb') as file:
|
with open(dest, 'wb') as file:
|
||||||
file.write(response.read())
|
file.write(response.read())
|
||||||
finally:
|
finally:
|
||||||
response.close()
|
response.close()
|
||||||
|
|
||||||
if IS_RUNNING_ON_AZURE or IS_RUNNING_ON_TRAVIS:
|
if IS_RUNNING_ON_AZURE or IS_RUNNING_ON_TRAVIS:
|
||||||
shell = simple_shell
|
shell = simple_shell
|
||||||
else:
|
else:
|
||||||
|
|||||||
Reference in New Issue
Block a user