Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Tools: add a script to download Unicode data files, and rename grapheme_break_property_data_gen.py to unicode_properties_data_gen.py #4435

Merged
merged 5 commits into from
Mar 8, 2024
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions stl/inc/__msvc_format_ucd_tables.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception

// WARNING, this entire header is generated by
// tools/unicode_properties_parse/grapheme_break_property_data_gen.py
// tools/unicode_properties_parse/unicode_properties_data_gen.py
// DO NOT MODIFY!

// UNICODE, INC. LICENSE AGREEMENT - DATA FILES AND SOFTWARE
Expand Down Expand Up @@ -112,7 +112,7 @@ struct _Unicode_property_data {
// The enums containing the values for the properties are also generated, in order to ensure they match
// up correctly with how we're parsing them.
//
// All sets of data tables are generated by tools/unicode_properties_parse/grapheme_break_property_data_gen.py in the
// All sets of data tables are generated by tools/unicode_properties_parse/unicode_properties_data_gen.py in the
// https://github.com/microsoft/stl repository.
//
// The data format is a set of arrays for each character property. The first is an array of uint32_t encoding
Expand Down
20 changes: 20 additions & 0 deletions tools/unicode_properties_parse/download_unicode_data_files.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
from urllib.request import urlretrieve
StephanTLavavej marked this conversation as resolved.
Show resolved Hide resolved


Unicode_data_files = {
"DerivedCoreProperties.txt": "https://www.unicode.org/Public/UCD/latest/ucd/DerivedCoreProperties.txt",
"DerivedGeneralCategory.txt": "https://www.unicode.org/Public/UCD/latest/ucd/extracted/DerivedGeneralCategory.txt",
"EastAsianWidth.txt": "https://www.unicode.org/Public/UCD/latest/ucd/EastAsianWidth.txt",
"GraphemeBreakProperty.txt": "https://www.unicode.org/Public/UCD/latest/ucd/auxiliary/GraphemeBreakProperty.txt",
"GraphemeBreakText.txt": "https://www.unicode.org/Public/UCD/latest/ucd/auxiliary/GraphemeBreakTest.txt",
StephanTLavavej marked this conversation as resolved.
Show resolved Hide resolved
"emoji-data.txt": "https://www.unicode.org/Public/UCD/latest/ucd/emoji/emoji-data.txt",
}

def download_unicode_data_files():
for filename, url in Unicode_data_files.items():
print(f"downloading {filename} from {url}")
urlretrieve(url, filename)


if __name__ == "__main__":
download_unicode_data_files()
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ def compact_property_ranges(input: list[PropertyRange]) -> list[PropertyRange]:
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception

// WARNING, this entire header is generated by
// tools/unicode_properties_parse/grapheme_break_property_data_gen.py
// tools/unicode_properties_parse/unicode_properties_data_gen.py
// DO NOT MODIFY!

// UNICODE, INC. LICENSE AGREEMENT - DATA FILES AND SOFTWARE
Expand Down Expand Up @@ -201,7 +201,7 @@ def compact_property_ranges(input: list[PropertyRange]) -> list[PropertyRange]:
// The enums containing the values for the properties are also generated, in order to ensure they match
// up correctly with how we're parsing them.
//
// All sets of data tables are generated by tools/unicode_properties_parse/grapheme_break_property_data_gen.py in the
// All sets of data tables are generated by tools/unicode_properties_parse/unicode_properties_data_gen.py in the
// https://github.com/microsoft/stl repository.
//
// The data format is a set of arrays for each character property. The first is an array of uint32_t encoding
Expand Down