From 4931dd2c914c22317f5ebf424636cd8c5f08510d Mon Sep 17 00:00:00 2001 From: Michael Williamson Date: Fri, 19 Dec 2025 11:48:46 +0000 Subject: Fix python314t build on Windows --- setup.py | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/setup.py b/setup.py index 538da85..1812938 100644 --- a/setup.py +++ b/setup.py @@ -36,6 +36,24 @@ class jq_with_deps_build_ext(build_ext): if os.name == "nt": self.compiler = "mingw32" + def get_libraries(self, ext: Extension) -> list[str]: + # When using non-MSVC compilers on Windows, the Python lib to link + # against generated by setuptools fails to add the "t" suffix for + # free-threaded builds. We therefore override `get_libraries` to + # work around this. + # + # See: https://github.com/pypa/setuptools/issues/5126 + if os.name == "nt" and sysconfig.get_config_var("Py_GIL_DISABLED"): + pythonlib = "python%d%dt" % ( + sys.hexversion >> 24, + (sys.hexversion >> 16) & 0xFF, + ) + if self.debug: + pythonlib += '_d' + return ext.libraries + [pythonlib] + else: + return build_ext.get_libraries(self, ext) + def run(self): if not os.path.exists(_dep_build_path(".")): os.makedirs(_dep_build_path(".")) -- cgit v1.2.3