summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Williamson <mike@zwobble.org>2025-12-19 11:48:46 +0000
committerMichael Williamson <mike@zwobble.org>2025-12-19 11:48:46 +0000
commit4931dd2c914c22317f5ebf424636cd8c5f08510d (patch)
tree4acf98aa21a433f4e538f486672300a77caa31cb
parentd848d3ecec59c7de23d42cfccd7221c9cbaaf059 (diff)
Fix python314t build on Windows
-rw-r--r--setup.py18
1 files changed, 18 insertions, 0 deletions
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("."))