From 627dfd9a5cdcce9e4122ef3041a38c3da2d3a120 Mon Sep 17 00:00:00 2001 From: Carl Hetherington Date: Sun, 27 Sep 2020 19:32:15 +0200 Subject: Load language tags from on-disk files rather than embedding them into a .cc. The .cc method causes compile times (and memory requirements) increase enormously with some compilers. --- scripts/update-language-subtags | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) (limited to 'scripts') diff --git a/scripts/update-language-subtags b/scripts/update-language-subtags index 5990085e..979d8168 100755 --- a/scripts/update-language-subtags +++ b/scripts/update-language-subtags @@ -1,5 +1,6 @@ #!/usr/bin/python3 +import os import urllib.request block = {} @@ -25,14 +26,10 @@ with urllib.request.urlopen('https://www.iana.org/assignments/language-subtag-re if len(p) > 1: block[p[0]] = p[1][1:] -def escape(s): - return s.replace('"', '\\"') - -with open('src/language_tag_lists.cc', 'w') as f: - for k, v in lists.items(): - print("static LanguageTag::SubtagData const %s_list[] = {" % k, file=f) +for k, v in lists.items(): + with open(os.path.join('tags', k), 'w') as f: + print(len(v), file=f) for e in v: - print('\t{ "%s", "%s" },' % (escape(e[0]), escape(e[1])), file=f) - print("};", file=f) - print("", file=f) + print(e[0], file=f) + print(e[1], file=f) -- cgit v1.2.3