Skip to content

Commit 80ae9a5

Browse files
authored
fix: do not subclass wheel.bdist_wheel command in ABI3 test (#2030)
fix: do not subclass bdist_wheel command in ABI3 test With bdist_wheel becoming a first-class citizen command of setuptools, this trick might not work in the future.
1 parent 006f1e6 commit 80ae9a5

File tree

1 file changed

+4
-15
lines changed

1 file changed

+4
-15
lines changed

test/test_abi_variants.py

+4-15
Original file line numberDiff line numberDiff line change
@@ -18,27 +18,16 @@
1818
IS_CPYTHON = sys.implementation.name == "cpython"
1919
Py_GIL_DISABLED = sysconfig.get_config_var("Py_GIL_DISABLED")
2020
CAN_USE_ABI3 = IS_CPYTHON and not Py_GIL_DISABLED
21-
cmdclass = {}
21+
setup_options = {}
2222
extension_kwargs = {}
2323
if CAN_USE_ABI3 and sys.version_info[:2] >= (3, 10):
24-
from wheel.bdist_wheel import bdist_wheel as _bdist_wheel
25-
26-
class bdist_wheel_abi3(_bdist_wheel):
27-
def finalize_options(self):
28-
_bdist_wheel.finalize_options(self)
29-
self.root_is_pure = False
30-
31-
def get_tag(self):
32-
python, abi, plat = _bdist_wheel.get_tag(self)
33-
return python, "abi3", plat
34-
35-
cmdclass["bdist_wheel"] = bdist_wheel_abi3
3624
extension_kwargs["define_macros"] = [("Py_LIMITED_API", "0x030A0000")]
3725
extension_kwargs["py_limited_api"] = True
26+
setup_options = {"bdist_wheel": {"py_limited_api": "cp310"}}
3827
"""
3928
),
4029
setup_py_extension_args_add="**extension_kwargs",
41-
setup_py_setup_args_add="cmdclass=cmdclass",
30+
setup_py_setup_args_add="options=setup_options",
4231
)
4332

4433
limited_api_project.files["pyproject.toml"] = pyproject_toml
@@ -65,7 +54,7 @@ def test_abi3(tmp_path):
6554
if utils.platform == "pyodide":
6655
# there's only 1 possible configuration for pyodide, the single_python_tag one
6756
expected_wheels = [
68-
w.replace(f"{single_python_tag}-{single_python_tag}", f"{single_python_tag}-abi3")
57+
w.replace(f"{single_python_tag}-{single_python_tag}", "cp310-abi3")
6958
for w in expected_wheels
7059
]
7160
else:

0 commit comments

Comments
 (0)