File tree Expand file tree Collapse file tree 3 files changed +19136
-7
lines changed Expand file tree Collapse file tree 3 files changed +19136
-7
lines changed Original file line number Diff line number Diff line change @@ -72,14 +72,16 @@ class OffsetType(enum.IntEnum):
72
72
BitPos = int
73
73
74
74
75
- def fetch_open (filename : str ):
75
+ def fetch_open (filename : str , local_prefix : str = "" ):
76
76
"""Opens `filename` and return its corresponding file object. If `filename` isn't on disk,
77
77
fetches it from `https://www.unicode.org/Public/`. Exits with code 1 on failure.
78
78
"""
79
79
basename = 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 ):
81
82
urllib .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 ,
83
85
)
84
86
try :
85
87
return open (basename , encoding = "utf-8" )
@@ -684,7 +686,7 @@ def main(module_filename: str):
684
686
variation_table = make_variation_sequence_table (emoji_variations , width_map )
685
687
686
688
# Download normalization test file for use by tests
687
- fetch_open ("NormalizationTest.txt" )
689
+ fetch_open ("NormalizationTest.txt" , "../tests/" )
688
690
689
691
print ("------------------------" )
690
692
total_size = 0
You can’t perform that action at this time.
0 commit comments