Skip to content

Commit

Permalink
BLD: automatically detect if in freethread build of Python
Browse files Browse the repository at this point in the history
  • Loading branch information
tacaswell committed Aug 20, 2024
1 parent fd677bd commit ae0d1f5
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
from warnings import warn
import packaging.version
from wheel.bdist_wheel import bdist_wheel
import sysconfig


LIBERFADIR = os.path.join('liberfa', 'erfa')
Expand All @@ -19,8 +20,12 @@
os.path.join('erfa', 'ufunc.c'),
]


# build with Py_LIMITED_API unless explicitly disabled
USE_PY_LIMITED_API = os.getenv("PYERFA_LIMITED_API", "1") != "0"
USE_PY_LIMITED_API = (
(not sysconfig.get_config_var("Py_GIL_DISABLED")) and
os.getenv("PYERFA_LIMITED_API", "1") != "0"
)

class bdist_wheel_abi3(bdist_wheel):
def get_tag(self):
Expand All @@ -38,7 +43,7 @@ def newer(source, target):
source = pathlib.Path(source)
if not source.exists():
raise FileNotFoundError(f"file '{source.resolve()}' does not exist")

target = pathlib.Path(target)
if not target.exists():
return 1
Expand Down

0 comments on commit ae0d1f5

Please sign in to comment.