@@ -72,14 +72,16 @@ class OffsetType(enum.IntEnum):
7272BitPos = int
7373
7474
75- def fetch_open (filename :str ):
75+ def fetch_open (filename :str , local_prefix : str = "" ):
7676"""Opens `filename` and return its corresponding file object. If `filename` isn't on disk,
7777 fetches it from `https://www.unicode.org/Public/`. Exits with code 1 on failure.
7878 """
7979basename = os .path .basename (filename )
80- if not os .path .exists (basename ):
80+ localname = os .path .join (local_prefix ,basename )
81+ if not os .path .exists (localname ):
8182urllib .request .urlretrieve (
82- f"https://www.unicode.org/Public/{ UNICODE_VERSION } /ucd/{ filename } " ,basename
83+ f"https://www.unicode.org/Public/{ UNICODE_VERSION } /ucd/{ filename } " ,
84+ localname ,
8385 )
8486try :
8587return open (basename ,encoding = "utf-8" )
@@ -684,7 +686,7 @@ def main(module_filename: str):
684686variation_table = make_variation_sequence_table (emoji_variations ,width_map )
685687
686688# Download normalization test file for use by tests
687- fetch_open ("NormalizationTest.txt" )
689+ fetch_open ("NormalizationTest.txt" , "../tests/" )
688690
689691print ("------------------------" )
690692total_size = 0