Skip to content

Commit 4e11c92

Browse files
committed
setup.py: Specify abi3 compat platform tag when built with cp312+
1 parent 5b646cd commit 4e11c92

File tree

1 file changed

+14
-1
lines changed

1 file changed

+14
-1
lines changed

setup.py

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,19 @@
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+
def get_tag(self):
17+
python, abi, plat = super().get_tag()
18+
19+
if python.startswith("cp") and sys.version_info >= (3, 12):
20+
# on CPython, our wheels are abi3 and compatible back to 3.12
21+
return "cp312", "abi3", plat
22+
23+
return python, abi, plat
24+
1225

1326
class BuildExtension(build_ext):
1427
"""
@@ -99,5 +112,5 @@ def add_pkg_data_dirs(pkg, dirs):
99112
package_data={
100113
"pypcode": add_pkg_data_dirs("pypcode", ["bin", "docs", "processors"]) + ["py.typed", "pypcode_native.pyi"]
101114
},
102-
cmdclass={"build_ext": BuildExtension},
115+
cmdclass={"build_ext": BuildExtension, "bdist_wheel": bdist_wheel_abi3},
103116
)

0 commit comments

Comments
 (0)