diff --git a/pygomx/setup.py b/pygomx/setup.py index d6ec407..d3b1f7d 100644 --- a/pygomx/setup.py +++ b/pygomx/setup.py @@ -1,8 +1,25 @@ import os import subprocess -from contextlib import suppress + from setuptools import Command, setup 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): @@ -63,5 +80,9 @@ class CustomBuild(build): setup( cffi_modules=["build_ffi.py:ffibuilder"], - cmdclass={"build": CustomBuild, "build_custom": CustomCommand}, + cmdclass={ + "build": CustomBuild, + "build_custom": CustomCommand, + "bdist_wheel": bdist_wheel_abi3, + }, ) diff --git a/pygomx/src/pygomx/pygomx.py b/pygomx/src/pygomx/pygomx.py index 2c0ebc7..aa34b5f 100644 --- a/pygomx/src/pygomx/pygomx.py +++ b/pygomx/src/pygomx/pygomx.py @@ -1,7 +1,9 @@ # -*- coding: utf-8 -*- -import logging -from _pygomx import lib, ffi import json +import logging + +from _pygomx import ffi, lib + from .errors import APIError logger = logging.getLogger(__name__)