Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 12 additions & 3 deletions bindings/python/scripts/verify_wheel_platform_tag.py
Original file line number Diff line number Diff line change
Expand Up @@ -80,10 +80,19 @@ def parse_wheel_tag(wheel_path: Path) -> tuple[tuple[int, int], str]:


def main() -> int:
parser = argparse.ArgumentParser(description=__doc__, formatter_class=argparse.RawDescriptionHelpFormatter)
parser = argparse.ArgumentParser(
description=__doc__, formatter_class=argparse.RawDescriptionHelpFormatter
)
parser.add_argument("wheel", nargs="?", type=Path, help="Path to the .whl file")
parser.add_argument("jre", nargs="?", type=Path, help="Path to the bundled JRE/JDK directory")
parser.add_argument("--jre", dest="jre_only", type=Path, help="Inspect a JRE only and print its required tag")
parser.add_argument(
"jre", nargs="?", type=Path, help="Path to the bundled JRE/JDK directory"
)
parser.add_argument(
"--jre",
dest="jre_only",
type=Path,
help="Inspect a JRE only and print its required tag",
)
args = parser.parse_args()

if args.jre_only is not None:
Expand Down
21 changes: 15 additions & 6 deletions bindings/python/tests/test_wheel_platform_tag.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,15 @@

import pytest


SCRIPT_PATH = Path(__file__).resolve().parents[1] / "scripts" / "verify_wheel_platform_tag.py"
SCRIPT_PATH = (
Path(__file__).resolve().parents[1] / "scripts" / "verify_wheel_platform_tag.py"
)


def _load_verifier():
spec = importlib.util.spec_from_file_location("verify_wheel_platform_tag", SCRIPT_PATH)
spec = importlib.util.spec_from_file_location(
"verify_wheel_platform_tag", SCRIPT_PATH
)
module = importlib.util.module_from_spec(spec)
assert spec.loader is not None
spec.loader.exec_module(module)
Expand Down Expand Up @@ -62,7 +65,9 @@ def test_parse_wheel_tag_extracts_version_and_arch(tmp_path: Path) -> None:
assert arch == "x86_64"


def test_main_succeeds_when_tag_matches(tmp_path: Path, capsys: pytest.CaptureFixture[str]) -> None:
def test_main_succeeds_when_tag_matches(
tmp_path: Path, capsys: pytest.CaptureFixture[str]
) -> None:
verifier = _load_verifier()
jre_dir = tmp_path / "jre"
jre_dir.mkdir()
Expand All @@ -76,7 +81,9 @@ def test_main_succeeds_when_tag_matches(tmp_path: Path, capsys: pytest.CaptureFi
assert "OK" in capsys.readouterr().out


def test_main_fails_when_tag_higher_than_jre(tmp_path: Path, capsys: pytest.CaptureFixture[str]) -> None:
def test_main_fails_when_tag_higher_than_jre(
tmp_path: Path, capsys: pytest.CaptureFixture[str]
) -> None:
"""Reproduces issue #4037: wheel tagged manylinux_2_35 but JRE only needs GLIBC_2.34."""
verifier = _load_verifier()
jre_dir = tmp_path / "jre"
Expand All @@ -93,7 +100,9 @@ def test_main_fails_when_tag_higher_than_jre(tmp_path: Path, capsys: pytest.Capt
assert "manylinux_2_35" in captured.err or "manylinux_2_34" in captured.err


def test_main_fails_when_tag_lower_than_jre(tmp_path: Path, capsys: pytest.CaptureFixture[str]) -> None:
def test_main_fails_when_tag_lower_than_jre(
tmp_path: Path, capsys: pytest.CaptureFixture[str]
) -> None:
"""A too-low tag would let the wheel install on systems where the JRE cannot run."""
verifier = _load_verifier()
jre_dir = tmp_path / "jre"
Expand Down
Loading