Skip to content

Commit 81ae8e2

Browse files
Specify unicode version in unicode.py
Ensures CI will keep passing until we choose to update
1 parent d7755f2 commit 81ae8e2

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

scripts/unicode.py

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,9 +27,13 @@
2727
import os
2828
import re
2929
import sys
30+
import urllib.request
3031
from collections import defaultdict
3132
from itertools import batched
3233

34+
UNICODE_VERSION = "15.1.0"
35+
"""The version of the Unicode data files to download."""
36+
3337
NUM_CODEPOINTS = 0x110000
3438
"""An upper bound for which `range(0, NUM_CODEPOINTS)` contains Unicode's codespace."""
3539

@@ -70,11 +74,13 @@ class OffsetType(enum.IntEnum):
7074

7175
def fetch_open(filename: str):
7276
"""Opens `filename` and return its corresponding file object. If `filename` isn't on disk,
73-
fetches it from `https://www.unicode.org/Public/UNIDATA/`. Exits with code 1 on failure.
77+
fetches it from `https://www.unicode.org/Public/`. Exits with code 1 on failure.
7478
"""
7579
basename = os.path.basename(filename)
7680
if not os.path.exists(basename):
77-
os.system(f"curl -O https://www.unicode.org/Public/UNIDATA/{filename}")
81+
urllib.request.urlretrieve(
82+
f"https://www.unicode.org/Public/{UNICODE_VERSION}/ucd/{filename}", basename
83+
)
7884
try:
7985
return open(basename, encoding="utf-8")
8086
except OSError:

0 commit comments

Comments
 (0)