1#!/usr/bin/python -B 2 3"""Regenerates (just) ICU data files used in the Android system image.""" 4 5from __future__ import print_function 6 7import os 8import sys 9 10import i18nutil 11import icuutil 12 13 14# Run with no arguments from any directory, with no special setup required. 15def main(): 16 icu_dir = icuutil.icuDir() 17 print('Found icu in %s ...' % icu_dir) 18 19 makeIcuDataFiles() 20 21 # if icu4c/source/data/misc/langInfo.txt is re-generated, the binary data files need to be 22 # re-generated. makeIcuDataFiles() are called until it coverages because the re-generation 23 # depends icu4j, and icu4j depends on the bigit nary data files. 24 while (icuutil.RequiredToMakeLangInfo()): 25 makeIcuDataFiles() 26 27 28 print('Look in %s for new data files' % icu_dir) 29 sys.exit(0) 30 31def makeIcuDataFiles(): 32 i18nutil.SwitchToNewTemporaryDirectory() 33 icu_build_dir = '%s/icu' % os.getcwd() 34 35 icuutil.PrepareIcuBuild(icu_build_dir) 36 37 icuutil.MakeAndCopyIcuDataFiles(icu_build_dir) 38 39 40if __name__ == '__main__': 41 main() 42