argon2-cffi-bindings/setup.py
Hynek Schlawack 1aad4747f9
Add support for free-threaded builds (#70)
* Build free-threaded wheels, disable limited API there

Co-authored-by: Min RK <151929+minrk@users.noreply.github.com>

* Try installing libffi-dev on Linux

It's faling due to lack of includes. Presumably because the lack of cffi
wheels.

* Revert "Try installing libffi-dev on Linux"

Does not work.

* Merge

* Actually build FT

* support the free-threaded build of Python 3.14 (#93)

* support the free-threaded build of Python 3.14

* attempt to get 3.14t CI to run

* Add trove classifier

* Add changelog

* Add 3.14 trove classifier, too

---------

Co-authored-by: Hynek Schlawack <hs@ox.cx>

---------

Co-authored-by: Min RK <151929+minrk@users.noreply.github.com>
Co-authored-by: Nathan Goldbaum <nathan.goldbaum@gmail.com>
2025-07-30 08:53:31 +02:00

43 lines
1.1 KiB
Python

# SPDX-License-Identifier: MIT
import platform
import sys
import sysconfig
from setuptools import setup
cmdclass = {}
if platform.python_implementation() == "CPython":
try:
try:
from setuptools.command.bdist_wheel import bdist_wheel
except ImportError:
from wheel.bdist_wheel import bdist_wheel
class BDistWheel(bdist_wheel):
def finalize_options(self):
# Free-threaded CPython doesn't support limited API.
if sysconfig.get_config_var("Py_GIL_DISABLED"):
self.py_limited_api = False
else:
self.py_limited_api = f"cp3{sys.version_info[1]}"
super().finalize_options()
cmdclass["bdist_wheel"] = BDistWheel
except ImportError:
pass
if __name__ == "__main__":
setup(
# Ensure limited API is set on CPython
cmdclass=cmdclass,
# CFFI
zip_safe=False,
ext_package="_argon2_cffi_bindings",
cffi_modules=["src/_argon2_cffi_bindings/_ffi_build.py:ffi"],
)