Skip to content

Commit f463d36

Browse files
committed
Hardcode version number
Fixes #1
1 parent 0fce2ea commit f463d36

File tree

1 file changed

+8
-9
lines changed

1 file changed

+8
-9
lines changed

scripts/unicode.py

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -34,13 +34,17 @@
3434
#![allow(missing_docs, non_upper_case_globals, non_snake_case)]
3535
'''
3636

37+
UNICODE_VERSION = (12, 1, 0)
38+
39+
UNICODE_VERSION_NUMBER = "%s.%s.%s" %UNICODE_VERSION
40+
3741
def fetch(f):
3842
if not os.path.exists(os.path.basename(f)):
39-
os.system("curl -O http://www.unicode.org/Public/security/latest/%s"
40-
% f)
43+
os.system("curl -O http://www.unicode.org/Public/security/%s/%s"
44+
% (UNICODE_VERSION_NUMBER, f))
4145

4246
if not os.path.exists(os.path.basename(f)):
43-
sys.stderr.write("cannot load %s" % f)
47+
sys.stderr.write("cannot load %s\n" % f)
4448
exit(1)
4549

4650
# load identifier status data
@@ -154,17 +158,12 @@ def emit_identifier_status_module(f, statuses_table):
154158
# write the file's preamble
155159
rf.write(preamble)
156160

157-
# download and parse all the data
158-
fetch("ReadMe.txt")
159-
with open("ReadMe.txt") as readme:
160-
pattern = "for Version (\d+)\.(\d+)\.(\d+) of"
161-
unicode_version = re.search(pattern, readme.read()).groups()
162161
rf.write("""
163162
/// The version of [Unicode](http://www.unicode.org/)
164163
/// that this version of unicode-security is based on.
165164
pub const UNICODE_VERSION: (u64, u64, u64) = (%s, %s, %s);
166165
167-
""" % unicode_version)
166+
""" % UNICODE_VERSION)
168167
### identifier status module
169168
identifier_status_table = load_identifier_status()
170169
emit_identifier_status_module(rf, identifier_status_table)

0 commit comments

Comments
 (0)