From 6eb189cb1c6ea6dd44dc713961d45125b5a19ae4 Mon Sep 17 00:00:00 2001 From: Gyeongjae Choi Date: Fri, 28 Mar 2025 13:48:09 +0000 Subject: [PATCH 1/2] Do not print python -m wheel output when unvendoring --- pyodide_build/common.py | 12 +++++++----- pyodide_build/recipe/unvendor.py | 2 +- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/pyodide_build/common.py b/pyodide_build/common.py index fa0448b0..3ed842d2 100644 --- a/pyodide_build/common.py +++ b/pyodide_build/common.py @@ -315,26 +315,28 @@ def _get_sha256_checksum(archive: Path) -> str: return h.hexdigest() -def unpack_wheel(wheel_path: Path, target_dir: Path | None = None) -> None: +def unpack_wheel(wheel_path: Path, target_dir: Path | None = None, verbose=True) -> None: if target_dir is None: target_dir = wheel_path.parent result = subprocess.run( [sys.executable, "-m", "wheel", "unpack", wheel_path, "-d", target_dir], check=False, encoding="utf-8", + capture_output=not verbose, ) if result.returncode != 0: logger.error("ERROR: Unpacking wheel %s failed", wheel_path.name) exit_with_stdio(result) -def pack_wheel(wheel_dir: Path, target_dir: Path | None = None) -> None: +def pack_wheel(wheel_dir: Path, target_dir: Path | None = None, verbose=True) -> None: if target_dir is None: target_dir = wheel_dir.parent result = subprocess.run( [sys.executable, "-m", "wheel", "pack", wheel_dir, "-d", target_dir], check=False, encoding="utf-8", + capture_output=not verbose, ) if result.returncode != 0: logger.error("ERROR: Packing wheel %s failed", wheel_dir) @@ -342,7 +344,7 @@ def pack_wheel(wheel_dir: Path, target_dir: Path | None = None) -> None: @contextmanager -def modify_wheel(wheel: Path) -> Iterator[Path]: +def modify_wheel(wheel: Path, verbose=True) -> Iterator[Path]: """Unpacks the wheel into a temp directory and yields the path to the unpacked directory. @@ -353,13 +355,13 @@ def modify_wheel(wheel: Path) -> Iterator[Path]: wheel is left unchanged. """ with TemporaryDirectory() as temp_dir: - unpack_wheel(wheel, Path(temp_dir)) + unpack_wheel(wheel, Path(temp_dir), verbose=verbose) name, ver, _ = wheel.name.split("-", 2) wheel_dir_name = f"{name}-{ver}" wheel_dir = Path(temp_dir) / wheel_dir_name yield wheel_dir wheel.unlink() - pack_wheel(wheel_dir, wheel.parent) + pack_wheel(wheel_dir, wheel.parent, verbose=verbose) def retag_wheel( diff --git a/pyodide_build/recipe/unvendor.py b/pyodide_build/recipe/unvendor.py index e1058bd7..bea35529 100644 --- a/pyodide_build/recipe/unvendor.py +++ b/pyodide_build/recipe/unvendor.py @@ -44,7 +44,7 @@ def unvendor_tests_in_wheel( with TemporaryDirectory() as _tmpdir: tmpdir = Path(_tmpdir) test_dir = tmpdir / "tests" - with modify_wheel(wheel) as wheel_extract_dir: + with modify_wheel(wheel, verbose=False) as wheel_extract_dir: nmoved = unvendor_tests( wheel_extract_dir, test_dir, From 473645221b0afad987227a514dd470edac6102d9 Mon Sep 17 00:00:00 2001 From: Gyeongjae Choi Date: Fri, 28 Mar 2025 13:48:37 +0000 Subject: [PATCH 2/2] lint [integration] --- pyodide_build/common.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/pyodide_build/common.py b/pyodide_build/common.py index 3ed842d2..aac62ef2 100644 --- a/pyodide_build/common.py +++ b/pyodide_build/common.py @@ -315,7 +315,9 @@ def _get_sha256_checksum(archive: Path) -> str: return h.hexdigest() -def unpack_wheel(wheel_path: Path, target_dir: Path | None = None, verbose=True) -> None: +def unpack_wheel( + wheel_path: Path, target_dir: Path | None = None, verbose=True +) -> None: if target_dir is None: target_dir = wheel_path.parent result = subprocess.run(