Skip to content

Commit 891e97c

Browse files
committed
setup.py: Specify abi3 compat platform tag when built with cp312+
1 parent 39d7244 commit 891e97c

File tree

1 file changed

+18
-1
lines changed

1 file changed

+18
-1
lines changed

setup.py

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,23 @@
99
from setuptools import setup
1010
from setuptools.command.build_ext import build_ext
1111

12+
from wheel.bdist_wheel import bdist_wheel
13+
14+
15+
class bdist_wheel_abi3(bdist_wheel):
16+
"""
17+
Overrides bdist_wheel to provide stable ABI platform tag.
18+
"""
19+
20+
def get_tag(self):
21+
python, abi, plat = super().get_tag()
22+
23+
if python.startswith("cp") and sys.version_info >= (3, 12):
24+
# on CPython, our wheels are abi3 and compatible back to 3.12
25+
return "cp312", "abi3", plat
26+
27+
return python, abi, plat
28+
1229

1330
class BuildExtension(build_ext):
1431
"""
@@ -99,5 +116,5 @@ def add_pkg_data_dirs(pkg, dirs):
99116
package_data={
100117
"pypcode": add_pkg_data_dirs("pypcode", ["bin", "docs", "processors"]) + ["py.typed", "pypcode_native.pyi"]
101118
},
102-
cmdclass={"build_ext": BuildExtension},
119+
cmdclass={"build_ext": BuildExtension, "bdist_wheel": bdist_wheel_abi3},
103120
)

0 commit comments

Comments
 (0)