|
34 | 34 | #![allow(missing_docs, non_upper_case_globals, non_snake_case)]
|
35 | 35 | '''
|
36 | 36 |
|
| 37 | +UNICODE_VERSION = (12, 1, 0) |
| 38 | + |
| 39 | +UNICODE_VERSION_NUMBER = "%s.%s.%s" %UNICODE_VERSION |
| 40 | + |
37 | 41 | def fetch(f):
|
38 | 42 | 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)) |
41 | 45 |
|
42 | 46 | 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) |
44 | 48 | exit(1)
|
45 | 49 |
|
46 | 50 | # load identifier status data
|
@@ -154,17 +158,12 @@ def emit_identifier_status_module(f, statuses_table):
|
154 | 158 | # write the file's preamble
|
155 | 159 | rf.write(preamble)
|
156 | 160 |
|
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() |
162 | 161 | rf.write("""
|
163 | 162 | /// The version of [Unicode](http://www.unicode.org/)
|
164 | 163 | /// that this version of unicode-security is based on.
|
165 | 164 | pub const UNICODE_VERSION: (u64, u64, u64) = (%s, %s, %s);
|
166 | 165 |
|
167 |
| -""" % unicode_version) |
| 166 | +""" % UNICODE_VERSION) |
168 | 167 | ### identifier status module
|
169 | 168 | identifier_status_table = load_identifier_status()
|
170 | 169 | emit_identifier_status_module(rf, identifier_status_table)
|
0 commit comments