MCPcopy Index your code
hub / github.com/nodejs/node / icu_download

Function icu_download

configure.py:2412–2444  ·  view source on GitHub ↗
(path)

Source from the content-addressed store, hash-verified

2410
2411def configure_intl(o):
2412 def icu_download(path):
2413 depFile = tools_path / 'icu' / 'current_ver.dep'
2414 icus = json.loads(depFile.read_text(encoding='utf-8'))
2415 # download ICU, if needed
2416 if not os.access(options.download_path, os.W_OK):
2417 error('''Cannot write to desired download path.
2418 Either create it or verify permissions.''')
2419 attemptdownload = nodedownload.candownload(auto_downloads, "icu")
2420 for icu in icus:
2421 url = icu['url']
2422 (expectHash, hashAlgo, allAlgos) = nodedownload.findHash(icu)
2423 if not expectHash:
2424 error(f'''Could not find a hash to verify ICU download.
2425 {depFile} may be incorrect.
2426 For the entry {url},
2427 Expected one of these keys: {' '.join(allAlgos)}''')
2428 local = url.split('/')[-1]
2429 targetfile = Path(options.download_path, local)
2430 if not targetfile.is_file():
2431 if attemptdownload:
2432 nodedownload.retrievefile(url, targetfile)
2433 else:
2434 print(f'Re-using existing {targetfile}')
2435 if targetfile.is_file():
2436 print(f'Checking file integrity with {hashAlgo}:\r')
2437 gotHash = nodedownload.checkHash(targetfile, hashAlgo)
2438 print(f'{hashAlgo}: {gotHash} {targetfile}')
2439 if expectHash == gotHash:
2440 return targetfile
2441
2442 warn(f'Expected: {expectHash} *MISMATCH*')
2443 warn(f'\n ** Corrupted ZIP? Delete {targetfile} to retry download.\n')
2444 return None
2445 icu_config = {
2446 'variables': {}
2447 }

Callers 1

configure_intlFunction · 0.85

Calls 6

errorFunction · 0.70
warnFunction · 0.70
printFunction · 0.50
accessMethod · 0.45
joinMethod · 0.45
splitMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…