Beispiel #1
0
def main():
    print 'Found source data file structure in %s ...' % timezone_input_data_dir

    iana_data_dir = '%s/iana' % timezone_input_data_dir
    iana_tar_file = tzdatautil.GetIanaTarFile(iana_data_dir)
    iana_version = ExtractIanaVersion(iana_tar_file)
    print 'Found IANA time zone data release %s in %s ...' % (iana_version,
                                                              iana_tar_file)

    print 'Found android output dir in %s ...' % timezone_output_data_dir

    icu_dir = icuutil.icuDir()
    print 'Found icu in %s ...' % icu_dir

    BuildIcuData(iana_tar_file)
    BuildTzdata(iana_tar_file)
    BuildTzlookup()

    # Create a distro file from the output from prior stages.
    distro_output_dir = '%s/distro' % timezone_output_data_dir
    CreateDistroFiles(iana_version, distro_output_dir)

    print 'Look in %s and %s for new files' % (timezone_output_data_dir,
                                               icu_dir)
    sys.exit(0)
Beispiel #2
0
def main():
    print 'Source data file structure: %s' % timezone_input_data_dir
    print 'Source tools file structure: %s' % timezone_input_tools_dir
    print 'Output data file structure: %s' % timezone_output_data_dir

    iana_input_data_dir = '%s/iana' % timezone_input_data_dir
    iana_data_tar_file = tzdatautil.GetIanaTarFile(iana_input_data_dir, 'data')
    iana_data_version = GetIanaVersion(iana_data_tar_file)
    print 'IANA time zone data release %s in %s ...' % (iana_data_version,
                                                        iana_data_tar_file)

    icu_dir = icuutil.icuDir()
    print 'Found icu in %s ...' % icu_dir

    BuildIcuData(iana_data_tar_file)

    iana_tools_dir = '%s/iana' % timezone_input_tools_dir
    zic_binary_file = BuildZic(iana_tools_dir)

    iana_data_dir = '%s/iana_data' % tmp_dir
    ExtractTarFile(iana_data_tar_file, iana_data_dir)
    BuildTzdata(zic_binary_file, iana_data_dir, iana_data_version)
    BuildTzlookup(iana_data_dir)

    # Create a distro file from the output from prior stages.
    distro_output_dir = '%s/distro' % timezone_output_data_dir
    CreateDistroFiles(iana_data_version, distro_output_dir)

    # Update test versions of distro files too.
    UpdateTestFiles()

    print 'Look in %s and %s for new files' % (timezone_output_data_dir,
                                               icu_dir)
    sys.exit(0)
Beispiel #3
0
def main():
  i18nutil.SwitchToNewTemporaryDirectory()
  icu_build_dir = '%s/icu' % os.getcwd()

  icu_dir = icuutil.icuDir()
  print 'Found icu in %s ...' % icu_dir

  icuutil.PrepareIcuBuild(icu_build_dir)

  icuutil.MakeAndCopyIcuDataFiles(icu_build_dir)

  print 'Look in %s for new data files' % icu_dir
  sys.exit(0)
Beispiel #4
0
def main():
    cldr_dir = icuutil.cldrDir()
    print('Found cldr in %s ...' % cldr_dir)
    icu_dir = icuutil.icuDir()
    print('Found icu in %s ...' % icu_dir)

    # Ant doesn't have any mechanism for using a build directory separate from the
    # source directory so this build script creates a temporary directory and then
    # copies all necessary ICU4J and CLDR source code to here before building it:
    i18nutil.SwitchToNewTemporaryDirectory()

    print('Copying ICU4J source code ...')
    shutil.copytree(os.path.join(icu_dir, 'icu4j'), 'icu4j', True)
    print('Building ICU4J ...')
    subprocess.check_call([
        'ant',
        '-f',
        'icu4j/build.xml',
        'jar',
        'cldrUtil',
    ])

    # Append the newly built JAR files to the Java CLASSPATH to use these instead
    # of the pre-built JAR files in the CLDR source tree, to ensure that the same
    # version of ICU is being used to build the data as will use the data:
    cp = []
    try:
        cp.append(os.environ['CLASSPATH'])
    except KeyError:
        pass
    cp.append('icu4j/icu4j.jar')
    cp.append('icu4j/out/cldr_util/lib/utilities.jar')
    os.environ['CLASSPATH'] = ':'.join(cp)

    # This is the location of the original CLDR source tree (not the temporary
    # copy of the tools source code) from where the data files are to be read:
    os.environ['CLDR_DIR'] = os.path.join(os.getcwd(), 'cldr')

    print('Copying CLDR source code ...')
    shutil.copytree(cldr_dir, 'cldr', True)
    print('Building CLDR tools ...')
    subprocess.check_call([
        'ant',
        '-f',
        os.path.join('cldr', 'tools', 'java', 'build.xml'),
        'jar',
        'AddPseudolocales',
    ])

    # This is the temporary directory in which the CLDR tools have been built:
    os.environ['CLDR_CLASSES'] = os.path.join(os.getcwd(), 'cldr', 'tools',
                                              'java', 'classes')

    # It's essential to set CLDR_DTD_CACHE for otherwise the repeated requests for
    # the same file will cause the unicode.org web server to block this machine:
    os.makedirs('cldr-dtd-cache')
    os.environ['ANT_OPTS'] = '-DCLDR_DTD_CACHE=%s' % pipes.quote(
        os.path.join(os.getcwd(), 'cldr-dtd-cache'))

    print('Building ICU data source files ...')
    subprocess.check_call([
        'ant',
        '-f',
        os.path.join(icu_dir, 'icu4c/source/data/build.xml'),
        'clean',
        'all',
    ])

    print('Look in %s/icu4c/source/data for new data source files' % icu_dir)
    sys.exit(0)