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/" ,
99
101
"_dbm" : ["dbm/ndbm.py" ],
100
102
"_gdbm" : ["dbm/gnu.py" ],
101
103
"_json" : ["json/" ],
102
- "_multiprocessing" : ["concurrent/" , "multiprocessing/" ],
104
+ "_multiprocessing" : ["concurrent/futures/process.py " , "multiprocessing/" ],
103
105
"pyexpat" : ["xml/" , "xmlrpc/" ],
104
106
"readline" : ["rlcompleter.py" ],
105
107
"_sqlite3" : ["sqlite3/" ],
106
108
"_ssl" : ["ssl.py" ],
107
109
"_tkinter" : ["idlelib/" , "tkinter/" , "turtle.py" , "turtledemo/" ],
108
-
109
110
"_zoneinfo" : ["zoneinfo/" ],
110
111
}
111
112
125
126
126
127
127
128
def get_builddir (args : argparse .Namespace ) -> pathlib .Path :
128
- """Get builddir path from pybuilddir.txt
129
- """
129
+ """Get builddir path from pybuilddir.txt"""
130
130
with open ("pybuilddir.txt" , encoding = "utf-8" ) as f :
131
131
builddir = f .read ()
132
132
return pathlib .Path (builddir )
133
133
134
134
135
135
def get_sysconfigdata (args : argparse .Namespace ) -> pathlib .Path :
136
- """Get path to sysconfigdata relative to build root
137
- """
136
+ """Get path to sysconfigdata relative to build root"""
138
137
data_name = sysconfig ._get_sysconfigdata_name ()
139
138
if not data_name .startswith (SYSCONFIG_NAMES ):
140
139
raise ValueError (
141
- f"Invalid sysconfig data name '{ data_name } '." ,
142
- SYSCONFIG_NAMES
140
+ f"Invalid sysconfig data name '{ data_name } '." , SYSCONFIG_NAMES
143
141
)
144
142
filename = data_name + ".py"
145
143
return args .builddir / filename
@@ -150,20 +148,23 @@ def create_stdlib_zip(
150
148
* ,
151
149
optimize : int = 0 ,
152
150
) -> None :
153
- def filterfunc (name : str ) -> bool :
154
- return not name .startswith (args .omit_subdirs_absolute )
151
+ def filterfunc (filename : str ) -> bool :
152
+ pathname = pathlib .Path (filename ).resolve ()
153
+ return pathname not in args .omit_files_absolute
155
154
156
155
with zipfile .PyZipFile (
157
- args .wasm_stdlib_zip , mode = "w" , compression = args .compression , optimize = optimize
156
+ args .wasm_stdlib_zip ,
157
+ mode = "w" ,
158
+ compression = args .compression ,
159
+ optimize = optimize ,
158
160
) as pzf :
159
161
if args .compresslevel is not None :
160
162
pzf .compresslevel = args .compresslevel
161
163
pzf .writepy (args .sysconfig_data )
162
164
for entry in sorted (args .srcdir_lib .iterdir ()):
165
+ entry = entry .resolve ()
163
166
if entry .name == "__pycache__" :
164
167
continue
165
- if entry in args .omit_files_absolute :
166
- continue
167
168
if entry .name .endswith (".py" ) or entry .is_dir ():
168
169
# writepy() writes .pyc files (bytecode).
169
170
pzf .writepy (entry , filterfunc = filterfunc )
@@ -247,10 +248,9 @@ def main():
247
248
if not extmods .get (modname ):
248
249
omit_files .extend (modfiles )
249
250
250
- args .omit_files_absolute = {args .srcdir_lib / name for name in omit_files }
251
- args .omit_subdirs_absolute = tuple (
252
- str (args .srcdir_lib / name ) for name in OMIT_SUBDIRS
253
- )
251
+ args .omit_files_absolute = {
252
+ (args .srcdir_lib / name ).resolve () for name in omit_files
253
+ }
254
254
255
255
# Empty, unused directory for dynamic libs, but required for site initialization.
256
256
args .wasm_dynload .mkdir (parents = True , exist_ok = True )
0 commit comments