(
path: str | Path,
pyodide_root: Path,
*,
skip_missing_files: bool = False,
)
| 92 | |
| 93 | |
| 94 | def 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 | |
| 132 | def parse_args(): |
searching dependent graphs…