File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -43,20 +43,29 @@ def run(self):
4343 if plat is None :
4444 raise RuntimeError (f"unsupported platform: { key } " )
4545
46- whl_name = f"{ MODULE } -{ VERSION } -py3-none-{ plat } .whl"
47- url = f"{ REPO_URL } /releases/download/{ TAG } /{ whl_name } "
46+ whl_names = [
47+ f"{ MODULE } -{ VERSION } -py3-none-{ plat } .whl" ,
48+ f"{ MODULE } -{ VERSION } -py3-none-any.whl" ,
49+ ]
4850
49- print (f"Downloading { url } ..." )
50- for attempt in range (3 ):
51- try :
52- raw = urlopen (url , timeout = 60 ).read ()
51+ raw = None
52+ for whl_name in whl_names :
53+ url = f"{ REPO_URL } /releases/download/{ TAG } /{ whl_name } "
54+ print (f"Downloading { url } ..." )
55+ for attempt in range (3 ):
56+ try :
57+ raw = urlopen (url , timeout = 60 ).read ()
58+ break
59+ except (URLError , OSError ) as e :
60+ if attempt == 2 :
61+ if whl_name == whl_names [- 1 ]:
62+ raise
63+ break
64+ wait = 2 ** attempt
65+ print (f"Download failed ({ e } ), retrying in { wait } s ..." )
66+ time .sleep (wait )
67+ if raw is not None :
5368 break
54- except (URLError , OSError ) as e :
55- if attempt == 2 :
56- raise
57- wait = 2 ** attempt
58- print (f"Download failed ({ e } ), retrying in { wait } s ..." )
59- time .sleep (wait )
6069
6170 print (f"Extracting { DATADIR } ..." )
6271 with zipfile .ZipFile (BytesIO (raw )) as zf :
You can’t perform that action at this time.
0 commit comments