Limit ABI3 builds to CPython only

This commit is contained in:
ZipFile 2025-05-19 13:34:29 +00:00
parent cfeb018ca7
commit 14be69371b

View File

@ -1,13 +1,17 @@
"""`Dependency injector` setup script.""" """`Dependency injector` setup script."""
import os import os
import sys
from Cython.Build import cythonize from Cython.Build import cythonize
from Cython.Compiler import Options from Cython.Compiler import Options
from setuptools import Extension, setup from setuptools import Extension, setup
debug = os.environ.get("DEPENDENCY_INJECTOR_DEBUG_MODE") == "1" debug = os.environ.get("DEPENDENCY_INJECTOR_DEBUG_MODE") == "1"
limited_api = os.environ.get("DEPENDENCY_INJECTOR_LIMITED_API") == "1" limited_api = (
os.environ.get("DEPENDENCY_INJECTOR_LIMITED_API") == "1"
and sys.implementation.name == "cpython"
)
defined_macros = [] defined_macros = []
options = {} options = {}
compiler_directives = { compiler_directives = {
@ -31,7 +35,7 @@ if debug:
if limited_api: if limited_api:
options.setdefault("bdist_wheel", {}) options.setdefault("bdist_wheel", {})
options["bdist_wheel"]["py_limited_api"] = "cp38" options["bdist_wheel"]["py_limited_api"] = "cp38"
defined_macros.append(("Py_LIMITED_API", 0x03080000)) defined_macros.append(("Py_LIMITED_API", "0x03080000"))
setup( setup(
options=options, options=options,