ICU-21073 Fix ICU Data Build Tool in "locale" mode.

This commit is contained in:
Shane F. Carr 2020-04-13 19:45:27 -05:00
parent 3fb3929f80
commit 9b2092fa89
4 changed files with 29 additions and 4 deletions

View file

@ -1,6 +1,6 @@
{
"localeFilter": {
"filterType": "language",
"filterType": "locale",
"whitelist": [
"en",
"de",

View file

@ -202,7 +202,7 @@ summarizes the ICU data files and their corresponding features and categories:
| Region Display <br/> Names | `"region_tree"` | region/\*.txt | **1.1 MiB** |
| Rule-Based <br/> Number Formatting <br/> (Spellout, Ordinals) | `"rbnf_tree"` | rbnf/\*.txt | 538 KiB |
| StringPrep | `"stringprep"` | sprep/\*.txt | 193 KiB |
| Time Zones | `"misc"` <br/> `"zone_tree"` | misc/metaZones.txt <br/> misc/timezoneTypes.txt <br/> misc/windowsZones.txt <br/> misc/zoneinfo64.txt <br/> zone/\*.txt | 41 KiB <br/> 20 KiB <br/> 22 KiB <br/> 151 KiB <br/> **2.7 MiB** |
| Time Zones | `"misc"` <br/> `"zone_tree"` <br/> `"zone_supplemental"` | misc/metaZones.txt <br/> misc/timezoneTypes.txt <br/> misc/windowsZones.txt <br/> misc/zoneinfo64.txt <br/> zone/\*.txt <br/> zone/tzdbNames.txt | 41 KiB <br/> 20 KiB <br/> 22 KiB <br/> 151 KiB <br/> **2.7 MiB** <br/> 4.8 KiB |
| Transliteration | `"translit"` | translit/\*.txt | 685 KiB |
| Unicode Character <br/> Names | `"unames"` | in/unames.icu | 269 KiB |
| Unicode Text Layout | `"ulayout"` | in/ulayout.icu | 14 KiB |

View file

@ -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]))

View file

@ -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]