MCPcopy
hub / github.com/pyodide/pyodide / create

Function create

tools/create_xbuildenv.py:94–129  ·  view source on GitHub ↗
(
    path: str | Path,
    pyodide_root: Path,
    *,
    skip_missing_files: bool = False,
)

Source from the content-addressed store, hash-verified

92
93
94def create(
95 path: str | Path,
96 pyodide_root: Path,
97 *,
98 skip_missing_files: bool = False,
99) -> None:
100 xbuildenv_path = Path(path) / "xbuildenv"
101 xbuildenv_root = xbuildenv_path / "pyodide-root"
102
103 shutil.rmtree(xbuildenv_path, ignore_errors=True)
104 xbuildenv_path.mkdir(parents=True, exist_ok=True)
105 xbuildenv_root.mkdir()
106
107 _copy_xbuild_files(pyodide_root, xbuildenv_path, skip_missing_files)
108 _copy_wasm_libs(pyodide_root, xbuildenv_root, skip_missing_files)
109 _copy_emcc_patches(pyodide_root, xbuildenv_root)
110
111 (xbuildenv_root / "package.json").write_text("{}")
112 res = subprocess.run(
113 ["pip", "freeze", "--path", get_build_flag("HOSTSITEPACKAGES")],
114 capture_output=True,
115 encoding="utf8",
116 check=False,
117 )
118 if res.returncode != 0:
119 logging.error("Failed to run pip freeze:")
120 if res.stdout:
121 logging.error(" stdout:")
122 logging.error(textwrap.indent(res.stdout, " "))
123 if res.stderr:
124 logging.error(" stderr:")
125 logging.error(textwrap.indent(res.stderr, " "))
126 sys.exit(1)
127
128 (xbuildenv_path / "requirements.txt").write_text(res.stdout)
129 (xbuildenv_root / "unisolated.txt").write_text("\n".join(get_unisolated_packages()))
130
131
132def parse_args():

Callers 2

test_xbuildenv_createFunction · 0.90
mainFunction · 0.85

Calls 6

_copy_xbuild_filesFunction · 0.85
_copy_wasm_libsFunction · 0.85
_copy_emcc_patchesFunction · 0.85
write_textMethod · 0.80
joinMethod · 0.80
runMethod · 0.45

Tested by 1

test_xbuildenv_createFunction · 0.72

Used in the wild real call sites across dependent graphs

searching dependent graphs…