Skip to content

Commit 7e7540a

Browse files
committed
setup.py: Specify abi3 compat platform tag when built with cp312+
1 parent e87649d commit 7e7540a

File tree

1 file changed

+17
-1
lines changed

1 file changed

+17
-1
lines changed

setup.py

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,22 @@
88
import sys
99
from setuptools import setup
1010
from setuptools.command.build_ext import build_ext
11+
from wheel.bdist_wheel import bdist_wheel
12+
13+
14+
class bdist_wheel_abi3(bdist_wheel):
15+
"""
16+
Overrides bdist_wheel to provide stable ABI platform tag.
17+
"""
18+
19+
def get_tag(self):
20+
python, abi, plat = super().get_tag()
21+
22+
if python.startswith("cp") and sys.version_info >= (3, 12):
23+
# on CPython, our wheels are abi3 and compatible back to 3.12
24+
return "cp312", "abi3", plat
25+
26+
return python, abi, plat
1127

1228

1329
class BuildExtension(build_ext):
@@ -99,5 +115,5 @@ def add_pkg_data_dirs(pkg, dirs):
99115
package_data={
100116
"pypcode": add_pkg_data_dirs("pypcode", ["bin", "docs", "processors"]) + ["py.typed", "pypcode_native.pyi"]
101117
},
102-
cmdclass={"build_ext": BuildExtension},
118+
cmdclass={"build_ext": BuildExtension, "bdist_wheel": bdist_wheel_abi3},
103119
)

0 commit comments

Comments
 (0)