diff options
| author | Michael Williamson <mike@zwobble.org> | 2025-12-19 11:48:46 +0000 |
|---|---|---|
| committer | Michael Williamson <mike@zwobble.org> | 2025-12-19 11:48:46 +0000 |
| commit | 4931dd2c914c22317f5ebf424636cd8c5f08510d (patch) | |
| tree | 4acf98aa21a433f4e538f486672300a77caa31cb /setup.py | |
| parent | d848d3ecec59c7de23d42cfccd7221c9cbaaf059 (diff) | |
Fix python314t build on Windows
Diffstat (limited to 'setup.py')
| -rw-r--r-- | setup.py | 18 |
1 files changed, 18 insertions, 0 deletions
@@ -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(".")) |
