@@ -79,6 +79,8 @@ def get(base, url, path, checksums, verbose=False):
79
79
eprint ("removing" , temp_path )
80
80
os .unlink (temp_path )
81
81
82
+ def curl_version ():
83
+ return re .match ("^curl ([0-9]+\\ .[0-9]+)" , run (["curl" , "-V" ]))[1 ]
82
84
83
85
def download (path , url , probably_big , verbose ):
84
86
for _ in range (4 ):
@@ -107,11 +109,15 @@ def _download(path, url, probably_big, verbose, exception):
107
109
# If curl is not present on Win32, we should not sys.exit
108
110
# but raise `CalledProcessError` or `OSError` instead
109
111
require (["curl" , "--version" ], exception = platform_is_win32 ())
110
- run (["curl" , option ,
112
+ extra_flags = []
113
+ if curl_version () > 7.70 :
114
+ extra_flags = [ "--retry-all-errors" ]
115
+ run (["curl" , option ] + extra_flags + [
111
116
"-L" , # Follow redirect.
112
117
"-y" , "30" , "-Y" , "10" , # timeout if speed is < 10 bytes/sec for > 30 seconds
113
118
"--connect-timeout" , "30" , # timeout if cannot connect within 30 seconds
114
119
"-o" , path ,
120
+ "--continue-at" , "-" ,
115
121
"--retry" , "3" , "-SRf" , url ],
116
122
verbose = verbose ,
117
123
exception = True , # Will raise RuntimeError on failure
0 commit comments