Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(3563)

Unified Diff: build_tools/write_res_index.py

Issue 1000163003: Generate the icu data binaries at compile time instead of checking in binaries Base URL: https://chromium.googlesource.com/chromium/deps/icu.git@master
Patch Set: Fixed warnings in cross compiling Created 5 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « build_tools/write_icupkg_inc.py ('k') | gn_data_build_system/BUILD.gn » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: build_tools/write_res_index.py
diff --git a/build_tools/write_res_index.py b/build_tools/write_res_index.py
new file mode 100644
index 0000000000000000000000000000000000000000..c20ad6fb30fe8c34383ca4f9625f5043e756f682
--- /dev/null
+++ b/build_tools/write_res_index.py
@@ -0,0 +1,44 @@
+"""Writes a res_index.txt file listing all locales (resources) that
+are included. This matches a half dozen "echo" blocks in the
+Makefiles."""
+
+from __future__ import print_function
+
+import argparse
+import os
+
+def change_ext(path, new_ext):
+ return os.path.splitext(path)[0] + new_ext
+
+def main():
+ parser = argparse.ArgumentParser(
+ description=("Generates a resindex.txt file to be compiled by icu."))
+
+ parser.add_argument("--outfile",
+ required=True,
+ help="File that will contain the ICU resource text.")
+
+ parser.add_argument("--cldr-version",
+ help="The CLDR version. Optional")
+
+ parser.add_argument("files",
+ nargs='*',
+ help=("Files to be included in the list. " +
+ "Can include paths (that will be ignored)"))
+
+ args = parser.parse_args()
+
+ with open(args.outfile, "w") as out:
+ out.write("// Warning this file is automatically generated\n")
+ out.write("res_index:table(nofallback) {\n")
+ if args.cldr_version:
+ out.write(" CLDRVersion { \"%s\" }\n" % args.cldr_version)
+ out.write(" InstalledLocales {\n")
+ for filename in args.files:
+ out.write(" %s {\"\"}\n" %
+ change_ext(os.path.basename(filename), ""))
+ out.write(" }\n")
+ out.write("}\n")
+
+if __name__ == "__main__":
+ main()
« no previous file with comments | « build_tools/write_icupkg_inc.py ('k') | gn_data_build_system/BUILD.gn » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698