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

Function create_stdlib_zip

Platforms/emscripten/wasm_assets.py:109–133  ·  view source on GitHub ↗
(
    args: argparse.Namespace,
    *,
    optimize: int = 0,
)

Source from the content-addressed store, hash-verified

107
108
109def create_stdlib_zip(
110 args: argparse.Namespace,
111 *,
112 optimize: int = 0,
113) -> None:
114 def filterfunc(filename: str) -> bool:
115 pathname = pathlib.Path(filename).resolve()
116 return pathname not in args.omit_files_absolute
117
118 with zipfile.PyZipFile(
119 args.output,
120 mode="w",
121 compression=args.compression,
122 optimize=optimize,
123 ) as pzf:
124 if args.compresslevel is not None:
125 pzf.compresslevel = args.compresslevel
126 pzf.writepy(args.sysconfig_data)
127 for entry in sorted(args.srcdir_lib.iterdir()):
128 entry = entry.resolve()
129 if entry.name == "__pycache__":
130 continue
131 if entry.name.endswith(".py") or entry.is_dir():
132 # writepy() writes .pyc files (bytecode).
133 pzf.writepy(entry, filterfunc=filterfunc)
134
135
136def detect_extension_modules(args: argparse.Namespace) -> dict[str, bool]:

Callers 1

mainFunction · 0.85

Calls 5

writepyMethod · 0.80
iterdirMethod · 0.45
resolveMethod · 0.45
endswithMethod · 0.45
is_dirMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…