improve wheel build

This commit is contained in:
saces 2026-03-10 10:40:20 +01:00
parent 23fc397384
commit 9997aa48f1
2 changed files with 27 additions and 4 deletions

View file

@ -1,8 +1,25 @@
import os import os
import subprocess import subprocess
from contextlib import suppress
from setuptools import Command, setup from setuptools import Command, setup
from setuptools.command.build import build from setuptools.command.build import build
from setuptools.command.bdist_wheel import bdist_wheel
class bdist_wheel_abi3(bdist_wheel):
def get_tag(self):
python, abi, plat = super().get_tag()
if python.startswith("cp") and not (python.endswith("t") or abi.endswith("t")):
if "android" in plat:
# cibuildwheel supports android since cp313, so we can't mark it as 310
return python, "abi3", plat
# On CPython, our wheels are abi3 and compatible back to 3.10.
# Free-threaded builds ("t" tag) must keep their original tags (PEP 803).
# Once PEP 803 is accepted, we may be able to build abi3t wheels.
return "cp310", "abi3", plat
return python, abi, plat
class CustomCommand(Command): class CustomCommand(Command):
@ -63,5 +80,9 @@ class CustomBuild(build):
setup( setup(
cffi_modules=["build_ffi.py:ffibuilder"], cffi_modules=["build_ffi.py:ffibuilder"],
cmdclass={"build": CustomBuild, "build_custom": CustomCommand}, cmdclass={
"build": CustomBuild,
"build_custom": CustomCommand,
"bdist_wheel": bdist_wheel_abi3,
},
) )

View file

@ -1,7 +1,9 @@
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
import logging
from _pygomx import lib, ffi
import json import json
import logging
from _pygomx import ffi, lib
from .errors import APIError from .errors import APIError
logger = logging.getLogger(__name__) logger = logging.getLogger(__name__)