Skip to content

Commit 1a0e0f2

Browse files
authored
Produce correct ABI tags for GraalPy (#557)
1 parent 3ec347d commit 1a0e0f2

File tree

3 files changed

+20
-2
lines changed

3 files changed

+20
-2
lines changed

docs/news.rst

+1
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ Release Notes
77
kernel (PR by Matthieu Darbois)
88
- Fixed ``wheel tags`` to not list directories in ``RECORD`` files
99
(PR by Mike Taves)
10+
- Fixed ABI tag generation for GraalPy (PR by Michael Simacek)
1011

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

src/wheel/bdist_wheel.py

+3
Original file line numberDiff line numberDiff line change
@@ -123,6 +123,9 @@ def get_abi_tag():
123123
# we want something like pypy36-pp73
124124
abi = "-".join(soabi.split("-")[:2])
125125
abi = abi.replace(".", "_").replace("-", "_")
126+
elif soabi and impl == "graalpy":
127+
abi = "-".join(soabi.split("-")[:3])
128+
abi = abi.replace(".", "_").replace("-", "_")
126129
elif soabi:
127130
abi = soabi.replace(".", "_").replace("-", "_")
128131
else:

tests/test_bdist_wheel.py

+16-2
Original file line numberDiff line numberDiff line change
@@ -287,18 +287,32 @@ def test_unix_epoch_timestamps(dummy_dist, monkeypatch, tmp_path):
287287
)
288288

289289

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

295295

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

301301

302+
def test_get_abi_tag_graalpy(monkeypatch):
303+
monkeypatch.setattr(
304+
sysconfig, "get_config_var", lambda x: "graalpy231-310-native-x86_64-linux"
305+
)
306+
monkeypatch.setattr(tags, "interpreter_name", lambda: "graalpy")
307+
assert get_abi_tag() == "graalpy231_310_native"
308+
309+
310+
def test_get_abi_tag_fallback(monkeypatch):
311+
monkeypatch.setattr(sysconfig, "get_config_var", lambda x: "unknown-python-310")
312+
monkeypatch.setattr(tags, "interpreter_name", lambda: "unknown-python")
313+
assert get_abi_tag() == "unknown_python_310"
314+
315+
302316
def test_platform_with_space(dummy_dist, monkeypatch):
303317
"""Ensure building on platforms with a space in the name succeed."""
304318
monkeypatch.chdir(dummy_dist)

0 commit comments

Comments
 (0)