58
58
# Pure Python implementations of C extensions
59
59
"_pydecimal.py" ,
60
60
"_pyio.py" ,
61
+ # concurrent threading
62
+ "concurrent/futures/thread.py" ,
61
63
# Misc unused or large files
62
64
"pydoc_data/" ,
63
65
"msilib/" ,
98
100
"_dbm" : ["dbm/ndbm.py" ],
99
101
"_gdbm" : ["dbm/gnu.py" ],
100
102
"_json" : ["json/" ],
101
- "_multiprocessing" : ["concurrent/" , "multiprocessing/" ],
103
+ "_multiprocessing" : ["concurrent/futures/process.py " , "multiprocessing/" ],
102
104
"pyexpat" : ["xml/" , "xmlrpc/" ],
103
105
"readline" : ["rlcompleter.py" ],
104
106
"_sqlite3" : ["sqlite3/" ],
105
107
"_ssl" : ["ssl.py" ],
106
108
"_tkinter" : ["idlelib/" , "tkinter/" , "turtle.py" , "turtledemo/" ],
107
-
108
109
"_zoneinfo" : ["zoneinfo/" ],
109
110
}
110
111
117
118
118
119
119
120
def get_builddir (args : argparse .Namespace ) -> pathlib .Path :
120
- """Get builddir path from pybuilddir.txt
121
- """
121
+ """Get builddir path from pybuilddir.txt"""
122
122
with open ("pybuilddir.txt" , encoding = "utf-8" ) as f :
123
123
builddir = f .read ()
124
124
return pathlib .Path (builddir )
125
125
126
126
127
127
def get_sysconfigdata (args : argparse .Namespace ) -> pathlib .Path :
128
- """Get path to sysconfigdata relative to build root
129
- """
128
+ """Get path to sysconfigdata relative to build root"""
130
129
data_name = sysconfig ._get_sysconfigdata_name ()
131
130
if not data_name .startswith (SYSCONFIG_NAMES ):
132
131
raise ValueError (
133
- f"Invalid sysconfig data name '{ data_name } '." ,
134
- SYSCONFIG_NAMES
132
+ f"Invalid sysconfig data name '{ data_name } '." , SYSCONFIG_NAMES
135
133
)
136
134
filename = data_name + ".py"
137
135
return args .builddir / filename
@@ -142,20 +140,26 @@ def create_stdlib_zip(
142
140
* ,
143
141
optimize : int = 0 ,
144
142
) -> None :
143
+ def filterfunc (filename : str ) -> bool :
144
+ pathname = pathlib .Path (filename ).resolve ()
145
+ return pathname not in args .omit_files_absolute
146
+
145
147
with zipfile .PyZipFile (
146
- args .wasm_stdlib_zip , mode = "w" , compression = args .compression , optimize = optimize
148
+ args .wasm_stdlib_zip ,
149
+ mode = "w" ,
150
+ compression = args .compression ,
151
+ optimize = optimize ,
147
152
) as pzf :
148
153
if args .compresslevel is not None :
149
154
pzf .compresslevel = args .compresslevel
150
155
pzf .writepy (args .sysconfig_data )
151
156
for entry in sorted (args .srcdir_lib .iterdir ()):
157
+ entry = entry .resolve ()
152
158
if entry .name == "__pycache__" :
153
159
continue
154
- if entry in args .omit_files_absolute :
155
- continue
156
160
if entry .name .endswith (".py" ) or entry .is_dir ():
157
161
# writepy() writes .pyc files (bytecode).
158
- pzf .writepy (entry )
162
+ pzf .writepy (entry , filterfunc = filterfunc )
159
163
160
164
161
165
def detect_extension_modules (args : argparse .Namespace ):
@@ -236,7 +240,9 @@ def main():
236
240
if not extmods .get (modname ):
237
241
omit_files .extend (modfiles )
238
242
239
- args .omit_files_absolute = {args .srcdir_lib / name for name in omit_files }
243
+ args .omit_files_absolute = {
244
+ (args .srcdir_lib / name ).resolve () for name in omit_files
245
+ }
240
246
241
247
# Empty, unused directory for dynamic libs, but required for site initialization.
242
248
args .wasm_dynload .mkdir (parents = True , exist_ok = True )
0 commit comments