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

Function configure_intl

configure.py:2411–2709  ·  view source on GitHub ↗
(o)

Source from the content-addressed store, hash-verified

2409 return file_list
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 }
2448 icu_config_name = 'icu_config.gypi'
2449
2450 # write an empty file to start with
2451 write(icu_config_name, do_not_edit +
2452 pprint.pformat(icu_config, indent=2, width=1024) + '\n')
2453
2454 # always set icu_small, node.gyp depends on it being defined.
2455 o['variables']['icu_small'] = b(False)
2456 o['variables']['icu_system'] = b(False)
2457
2458 # prevent data override
2459 o['defines'] += ['ICU_NO_USER_DATA_OVERRIDE']
2460
2461 with_intl = options.with_intl
2462 with_icu_source = options.with_icu_source
2463 have_icu_path = bool(options.with_icu_path)
2464 if have_icu_path and with_intl != 'none':
2465 error('Cannot specify both --with-icu-path and --with-intl')
2466 elif have_icu_path:
2467 # Chromium .gyp mode: --with-icu-path
2468 o['variables']['v8_enable_i18n_support'] = 1

Callers 1

configure.pyFile · 0.85

Calls 15

strFunction · 0.85
sortedFunction · 0.85
pkg_configFunction · 0.85
intFunction · 0.85
icu_downloadFunction · 0.85
print_verboseFunction · 0.85
glob_to_varFunction · 0.85
writeFunction · 0.70
bFunction · 0.70
errorFunction · 0.70
warnFunction · 0.70
addMethod · 0.65

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…