Skip to content

Commit

Permalink
Produce correct ABI tags for GraalPy (#557)
Browse files Browse the repository at this point in the history
  • Loading branch information
msimacek authored Aug 22, 2023
1 parent 3ec347d commit 1a0e0f2
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 2 deletions.
1 change: 1 addition & 0 deletions docs/news.rst
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ Release Notes
kernel (PR by Matthieu Darbois)
- Fixed ``wheel tags`` to not list directories in ``RECORD`` files
(PR by Mike Taves)
- Fixed ABI tag generation for GraalPy (PR by Michael Simacek)

**0.41.1 (2023-08-05)**

Expand Down
3 changes: 3 additions & 0 deletions src/wheel/bdist_wheel.py
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,9 @@ def get_abi_tag():
# we want something like pypy36-pp73
abi = "-".join(soabi.split("-")[:2])
abi = abi.replace(".", "_").replace("-", "_")
elif soabi and impl == "graalpy":
abi = "-".join(soabi.split("-")[:3])
abi = abi.replace(".", "_").replace("-", "_")
elif soabi:
abi = soabi.replace(".", "_").replace("-", "_")
else:
Expand Down
18 changes: 16 additions & 2 deletions tests/test_bdist_wheel.py
Original file line number Diff line number Diff line change
Expand Up @@ -287,18 +287,32 @@ def test_unix_epoch_timestamps(dummy_dist, monkeypatch, tmp_path):
)


def test_get_abi_tag_old(monkeypatch):
def test_get_abi_tag_pypy_old(monkeypatch):
monkeypatch.setattr(tags, "interpreter_name", lambda: "pp")
monkeypatch.setattr(sysconfig, "get_config_var", lambda x: "pypy36-pp73")
assert get_abi_tag() == "pypy36_pp73"


def test_get_abi_tag_new(monkeypatch):
def test_get_abi_tag_pypy_new(monkeypatch):
monkeypatch.setattr(sysconfig, "get_config_var", lambda x: "pypy37-pp73-darwin")
monkeypatch.setattr(tags, "interpreter_name", lambda: "pp")
assert get_abi_tag() == "pypy37_pp73"


def test_get_abi_tag_graalpy(monkeypatch):
monkeypatch.setattr(
sysconfig, "get_config_var", lambda x: "graalpy231-310-native-x86_64-linux"
)
monkeypatch.setattr(tags, "interpreter_name", lambda: "graalpy")
assert get_abi_tag() == "graalpy231_310_native"


def test_get_abi_tag_fallback(monkeypatch):
monkeypatch.setattr(sysconfig, "get_config_var", lambda x: "unknown-python-310")
monkeypatch.setattr(tags, "interpreter_name", lambda: "unknown-python")
assert get_abi_tag() == "unknown_python_310"


def test_platform_with_space(dummy_dist, monkeypatch):
"""Ensure building on platforms with a space in the name succeed."""
monkeypatch.chdir(dummy_dist)
Expand Down

0 comments on commit 1a0e0f2

Please sign in to comment.