diff options
| -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(".")) |
