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
6 changes: 5 additions & 1 deletion pycross/private/tools/wheel_installer.py
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,11 @@ def _validate_wheel_identity(
f"but wheel filename has '{actual_name}'"
)

if expected_version and actual_version != expected_version:
# A wheel filename may carry a local version segment (e.g. a CUDA
# build `3.0.0+cu130torch2110`) that the locked version (`3.0.0`) omits.
# Compare only the public version (everything before `+`) so such wheels
# are accepted while genuine version differences are still rejected.
if expected_version and actual_version.split("+", 1)[0] != expected_version.split("+", 1)[0]:
raise SystemExit(
f"error: wheel version mismatch for {wheel_path.name}: "
f"expected version '{expected_version}' "
Expand Down
9 changes: 9 additions & 0 deletions tests/unit/wheel_installer_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -161,6 +161,15 @@ def test_mismatched_version_raises(self):
_validate_wheel_identity(whl, "six", "1.17.0")
self.assertIn("wheel version mismatch", str(cm.exception))

def test_local_version_segment_passes(self):
from pycross.private.tools.wheel_installer import _validate_wheel_identity

# Wheel filename carries a PEP 440 local version segment (e.g. a CUDA
# build) that the locked version omits; only the public version is compared.
whl = self._create_wheel("foo-1.0+cu130-py3-none-any.whl", "foo", "1.0")
# Should not raise
_validate_wheel_identity(whl, "foo", "1.0")

def test_none_expected_skips_check(self):
from pycross.private.tools.wheel_installer import _validate_wheel_identity

Expand Down
Loading