-
Notifications
You must be signed in to change notification settings - Fork 9
/
setup.py
39 lines (32 loc) · 968 Bytes
/
setup.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
import os
import sys
import sysconfig
from setuptools import Extension, find_packages, setup
ext_modules = []
setup_kwargs = {}
ext_kwargs = {}
is_free_threading = sysconfig.get_config_var("Py_GIL_DISABLED") == 1
if not is_free_threading:
ext_kwargs["py_limited_api"] = True
ext_kwargs["define_macros"] = [("Py_LIMITED_API", 0x03A00000)]
opts = setup_kwargs.setdefault("options", {})
opts["bdist_wheel"] = {"py_limited_api": "cp310"}
if (
sys.implementation.name == "cpython"
and sys.version_info[:2] >= (3, 10)
and os.environ.get("CONVTOOLS_CEXT_DISABLED", "") != "1"
):
ext_modules.append(
Extension(
name="convtools._cext",
sources=["src/convtools/c_extensions/getters.c"],
optional=True,
extra_compile_args=["-w"],
**ext_kwargs,
)
)
setup(
ext_modules=ext_modules,
packages=find_packages("src", exclude=["tests"]),
**setup_kwargs,
)