@@ -79,6 +79,8 @@ def get(base, url, path, checksums, verbose=False):
7979 eprint ("removing" , temp_path )
8080 os .unlink (temp_path )
8181
82+ def curl_version ():
83+ return re .match ("^curl ([0-9]+\\ .[0-9]+)" , run (["curl" , "-V" ]))[1 ]
8284
8385def download (path , url , probably_big , verbose ):
8486 for _ in range (4 ):
@@ -107,11 +109,15 @@ def _download(path, url, probably_big, verbose, exception):
107109 # If curl is not present on Win32, we should not sys.exit
108110 # but raise `CalledProcessError` or `OSError` instead
109111 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 + [
111116 "-L" , # Follow redirect.
112117 "-y" , "30" , "-Y" , "10" , # timeout if speed is < 10 bytes/sec for > 30 seconds
113118 "--connect-timeout" , "30" , # timeout if cannot connect within 30 seconds
114119 "-o" , path ,
120+ "--continue-at" , "-" ,
115121 "--retry" , "3" , "-SRf" , url ],
116122 verbose = verbose ,
117123 exception = True , # Will raise RuntimeError on failure
0 commit comments