Skip to content

Commit 3ded3df

Browse files
srl295MylesBorins
authored andcommitted
tools, icu: actually failover if there are multiple URLs
Building on #23269, if multiple ICU download URLs are present, try the next one in case of error. Part of the ICU 63.1 bump, but independent code-wise. #23244 PR-URL: #23715Fixes: #22344 Reviewed-By: Refael Ackermann <[email protected]> Reviewed-By: Richard Lau <[email protected]> Reviewed-By: Gus Caplan <[email protected]> Reviewed-By: Michael Dawson <[email protected]>
1 parent 437a90c commit 3ded3df

File tree

2 files changed

+15
-10
lines changed

2 files changed

+15
-10
lines changed

‎configure.py‎

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1312,8 +1312,8 @@ def icu_download(path):
13121312
if (md5==gotmd5):
13131313
returntargetfile
13141314
else:
1315-
error('Expected: %s *MISMATCH*'%md5)
1316-
error('\n ** Corrupted ZIP? Delete %s to retry download.\n'%targetfile)
1315+
warn('Expected: %s *MISMATCH*'%md5)
1316+
warn('\n ** Corrupted ZIP? Delete %s to retry download.\n'%targetfile)
13171317
returnNone
13181318
icu_config={
13191319
'variables':{}
@@ -1462,11 +1462,12 @@ def write_config(data, name):
14621462
# ICU source dir relative to tools/icu (for .gyp file)
14631463
o['variables']['icu_path'] =icu_full_path
14641464
ifnotos.path.isdir(icu_full_path):
1465-
warn('* ECMA-402 (Intl) support didn\'t find ICU in %s..'%icu_full_path)
14661465
# can we download (or find) a zipfile?
14671466
localzip=icu_download(icu_full_path)
14681467
iflocalzip:
14691468
nodedownload.unpack(localzip, icu_parent_path)
1469+
else:
1470+
warn('* ECMA-402 (Intl) support didn\'t find ICU in %s..'%icu_full_path)
14701471
ifnotos.path.isdir(icu_full_path):
14711472
error('''Cannot build Intl without ICU in %s.
14721473
Fix, or disable with "--with-intl=none"'''%icu_full_path)

‎tools/configure.d/nodedownload.py‎

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
#!/usr/bin/env python
22
# Moved some utilities here from ../../configure
33

4+
from __future__ importprint_function
45
importurllib
56
importhashlib
67
importsys
@@ -36,10 +37,13 @@ def retrievefile(url, targetfile):
3637
sys.stdout.write(' <%s>\nConnecting...\r'%url)
3738
sys.stdout.flush()
3839
ConfigOpener().retrieve(url, targetfile, reporthook=reporthook)
39-
print''# clear the line
40+
print('')# clear the line
4041
returntargetfile
42+
exceptIOErroraserr:
43+
print(' ** IOError %s\n'%err)
44+
returnNone
4145
except:
42-
print' ** Error occurred while downloading\n <%s>'%url
46+
print(' ** Error occurred while downloading\n <%s>'%url)
4347
raise
4448

4549
defmd5sum(targetfile):
@@ -56,12 +60,12 @@ def unpack(packedfile, parent_path):
5660
"""Unpacks packedfile into parent_path. Assumes .zip. Returns parent_path"""
5761
ifzipfile.is_zipfile(packedfile):
5862
withcontextlib.closing(zipfile.ZipFile(packedfile, 'r')) asicuzip:
59-
print' Extracting zipfile: %s'%packedfile
63+
print(' Extracting zipfile: %s'%packedfile)
6064
icuzip.extractall(parent_path)
6165
returnparent_path
6266
eliftarfile.is_tarfile(packedfile):
6367
withcontextlib.closing(tarfile.TarFile.open(packedfile, 'r')) asicuzip:
64-
print' Extracting tarfile: %s'%packedfile
68+
print(' Extracting tarfile: %s'%packedfile)
6569
icuzip.extractall(parent_path)
6670
returnparent_path
6771
else:
@@ -112,7 +116,7 @@ def parse(opt):
112116
theRet[anOpt] =True
113117
else:
114118
# future proof: ignore unknown types
115-
print'Warning: ignoring unknown --download= type "%s"'%anOpt
119+
print('Warning: ignoring unknown --download= type "%s"'%anOpt)
116120
# all done
117121
returntheRet
118122

@@ -122,6 +126,6 @@ def candownload(auto_downloads, package):
122126
ifauto_downloads[package]:
123127
returnTrue
124128
else:
125-
print"""Warning: Not downloading package "%s". You could pass "--download=all"
126-
(Windows: "download-all") to try auto-downloading it."""%package
129+
print("""Warning: Not downloading package "%s". You could pass "--download=all"
130+
(Windows: "download-all") to try auto-downloading it."""%package)
127131
returnFalse

0 commit comments

Comments
(0)