From 9b2092fa8921a765e27ee110f15fcc753f0c8e56 Mon Sep 17 00:00:00 2001 From: "Shane F. Carr" Date: Mon, 13 Apr 2020 19:45:27 -0500 Subject: [PATCH] ICU-21073 Fix ICU Data Build Tool in "locale" mode. --- .ci-builds/data-filter.json | 2 +- docs/userguide/icu_data/buildtool.md | 2 +- icu4c/source/data/BUILDRULES.py | 27 ++++++++++++++++++- .../python/icutools/databuilder/filtration.py | 2 +- 4 files changed, 29 insertions(+), 4 deletions(-) diff --git a/.ci-builds/data-filter.json b/.ci-builds/data-filter.json index d2dd74d4bb1..ffde99567d0 100644 --- a/.ci-builds/data-filter.json +++ b/.ci-builds/data-filter.json @@ -1,6 +1,6 @@ { "localeFilter": { - "filterType": "language", + "filterType": "locale", "whitelist": [ "en", "de", diff --git a/docs/userguide/icu_data/buildtool.md b/docs/userguide/icu_data/buildtool.md index aa34b8ed8e5..7c3eadcc262 100644 --- a/docs/userguide/icu_data/buildtool.md +++ b/docs/userguide/icu_data/buildtool.md @@ -202,7 +202,7 @@ summarizes the ICU data files and their corresponding features and categories: | Region Display
Names | `"region_tree"` | region/\*.txt | **1.1 MiB** | | Rule-Based
Number Formatting
(Spellout, Ordinals) | `"rbnf_tree"` | rbnf/\*.txt | 538 KiB | | StringPrep | `"stringprep"` | sprep/\*.txt | 193 KiB | -| Time Zones | `"misc"`
`"zone_tree"` | misc/metaZones.txt
misc/timezoneTypes.txt
misc/windowsZones.txt
misc/zoneinfo64.txt
zone/\*.txt | 41 KiB
20 KiB
22 KiB
151 KiB
**2.7 MiB** | +| Time Zones | `"misc"`
`"zone_tree"`
`"zone_supplemental"` | misc/metaZones.txt
misc/timezoneTypes.txt
misc/windowsZones.txt
misc/zoneinfo64.txt
zone/\*.txt
zone/tzdbNames.txt | 41 KiB
20 KiB
22 KiB
151 KiB
**2.7 MiB**
4.8 KiB | | Transliteration | `"translit"` | translit/\*.txt | 685 KiB | | Unicode Character
Names | `"unames"` | in/unames.icu | 269 KiB | | Unicode Text Layout | `"ulayout"` | in/ulayout.icu | 14 KiB | diff --git a/icu4c/source/data/BUILDRULES.py b/icu4c/source/data/BUILDRULES.py index 2338afd1f71..e6ddea95c47 100644 --- a/icu4c/source/data/BUILDRULES.py +++ b/icu4c/source/data/BUILDRULES.py @@ -33,6 +33,7 @@ def generate(config, io, common_vars): requests += generate_unames(config, io, common_vars) requests += generate_misc(config, io, common_vars) requests += generate_curr_supplemental(config, io, common_vars) + requests += generate_zone_supplemental(config, io, common_vars) requests += generate_translit(config, io, common_vars) # Res Tree Files @@ -399,6 +400,29 @@ def generate_curr_supplemental(config, io, common_vars): ] +def generate_zone_supplemental(config, io, common_vars): + # tzdbNames Res File + input_file = InFile("zone/tzdbNames.txt") + input_basename = "tzdbNames.txt" + output_file = OutFile("zone/tzdbNames.res") + return [ + SingleExecutionRequest( + name = "zone_supplemental_res", + category = "zone_supplemental", + dep_targets = [], + input_files = [input_file], + output_files = [output_file], + tool = IcuTool("genrb"), + args = "-s {IN_DIR}/zone -d {OUT_DIR}/zone -i {OUT_DIR} " + "-k " + "{INPUT_BASENAME}", + format_with = { + "INPUT_BASENAME": input_basename + } + ) + ] + + def generate_translit(config, io, common_vars): input_files = [ InFile("translit/root.txt"), @@ -444,10 +468,11 @@ def generate_tree( requests = [] category = "%s_tree" % sub_dir out_prefix = "%s/" % out_sub_dir if out_sub_dir else "" - # TODO: Clean this up for curr input_files = [InFile(filename) for filename in io.glob("%s/*.txt" % sub_dir)] if sub_dir == "curr": input_files.remove(InFile("curr/supplementalData.txt")) + if sub_dir == "zone": + input_files.remove(InFile("zone/tzdbNames.txt")) input_basenames = [v.filename[len(sub_dir)+1:] for v in input_files] output_files = [ OutFile("%s%s.res" % (out_prefix, v[:-4])) diff --git a/icu4c/source/python/icutools/databuilder/filtration.py b/icu4c/source/python/icutools/databuilder/filtration.py index acdba0ee5b2..554013ac98d 100644 --- a/icu4c/source/python/icutools/databuilder/filtration.py +++ b/icu4c/source/python/icutools/databuilder/filtration.py @@ -217,7 +217,7 @@ class LocaleFilter(Filter): return "root" i = locale.rfind("_") if i < 0: - assert locale == "root" + assert locale == "root", "Invalid locale: %s/%s" % (tree, locale) return None return locale[:i] -- 2.40.0