MCPcopy Index your code
hub / github.com/python/cpython / main

Function main

Platforms/emscripten/wasm_assets.py:191–230  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

189
190
191def main() -> None:
192 args = parser.parse_args()
193
194 relative_prefix = args.prefix.relative_to(pathlib.Path("/"))
195 args.srcdir = SRCDIR
196 args.srcdir_lib = SRCDIR_LIB
197 args.wasm_root = args.buildroot / relative_prefix
198 args.wasm_stdlib = args.wasm_root / WASM_STDLIB
199 args.wasm_dynload = args.wasm_root / WASM_DYNLOAD
200
201 # bpo-17004: zipimport supports only zlib compression.
202 # Emscripten ZIP_STORED + -sLZ4=1 linker flags results in larger file.
203 args.compression = zipfile.ZIP_DEFLATED
204 args.compresslevel = 9
205
206 args.builddir = get_builddir(args)
207 args.sysconfig_data = get_sysconfigdata(args)
208 if not args.sysconfig_data.is_file():
209 raise ValueError(f"sysconfigdata file {args.sysconfig_data} missing.")
210
211 extmods = detect_extension_modules(args)
212 omit_files = list(OMIT_FILES)
213 if sysconfig.get_platform().startswith("emscripten"):
214 omit_files.extend(OMIT_NETWORKING_FILES)
215 for modname, modfiles in OMIT_MODULE_FILES.items():
216 if not extmods.get(modname):
217 omit_files.extend(modfiles)
218
219 args.omit_files_absolute = {
220 (args.srcdir_lib / name).resolve() for name in omit_files
221 }
222
223 # Empty, unused directory for dynamic libs, but required for site initialization.
224 args.wasm_dynload.mkdir(parents=True, exist_ok=True)
225 marker = args.wasm_dynload / ".empty"
226 marker.touch()
227 # The rest of stdlib that's useful in a WASM context.
228 create_stdlib_zip(args)
229 size = round(args.output.stat().st_size / 1024**2, 2)
230 parser.exit(0, f"Created {args.output} ({size} MiB)\n")
231
232
233if __name__ == "__main__":

Callers 1

wasm_assets.pyFile · 0.70

Calls 15

get_builddirFunction · 0.85
get_sysconfigdataFunction · 0.85
detect_extension_modulesFunction · 0.85
listClass · 0.85
create_stdlib_zipFunction · 0.85
parse_argsMethod · 0.45
relative_toMethod · 0.45
is_fileMethod · 0.45
startswithMethod · 0.45
extendMethod · 0.45
itemsMethod · 0.45
getMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…