Skip to content

Commit 13009b9

Browse files
fix: abi3 backwards & Python_SABI_LIBRARY bug (#352)
Discovery doesn't work when cross compiling, so it's important these are set. Also need to set Python_SABI_LIBRARY separately. --------- Signed-off-by: Henry Schreiner <[email protected]> Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
1 parent 12c8b96 commit 13009b9

File tree

2 files changed

+10
-4
lines changed

2 files changed

+10
-4
lines changed

README.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -220,8 +220,8 @@ backends:
220220
- [meson-python][]: A meson-based build backend; has some maintainer overlap
221221
with scikit-build-core.
222222
- [maturin][]: A build backend for Rust projects, using Cargo.
223-
- [enscons][]: A SCons based backend, not very actively developed (it predates
224-
all the others in modern standard support!)
223+
- [enscons][]: A SCons based backend, not very actively developed (but it
224+
predates all the others in modern standard support!)
225225

226226
If you don't need a binary build, you don't need to use a binary build backend!
227227
There are some very good Python build backends; we recommend [hatchling][] as a
@@ -253,6 +253,7 @@ Support for this work was provided by NSF cooperative agreement [OAC-2209877][].
253253
[OAC-2209877]: https://www.nsf.gov/awardsearch/showAward?AWD_ID=2209877&HistoricalAwards=false
254254
[hatchling]: https://hatch.pypa.io/latest
255255
[maturin]: https://www.maturin.rs
256+
[meson-python]: https://meson-python.readthedocs.io
256257
[enscons]: https://pypi.org/project/enscons
257258
[py-build-cmake]: https://tttapa.github.io/py-build-cmake
258259
<!-- prettier-ignore-end -->

src/scikit_build_core/builder/builder.py

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -129,11 +129,14 @@ def configure(
129129
if limited_abi is None:
130130
if self.settings.wheel.py_api.startswith("cp3"):
131131
target_minor_version = int(self.settings.wheel.py_api[3:])
132-
limited_abi = target_minor_version >= sys.version_info.minor
132+
limited_abi = target_minor_version <= sys.version_info.minor
133133
else:
134134
limited_abi = False
135135

136-
python_library = get_python_library(self.config.env, abi3=limited_abi)
136+
python_library = get_python_library(self.config.env, abi3=False)
137+
python_sabi_library = (
138+
get_python_library(self.config.env, abi3=True) if limited_abi else None
139+
)
137140
python_include_dir = get_python_include_dir()
138141

139142
# Classic Find Python
@@ -151,6 +154,8 @@ def configure(
151154
# FindPython may break if this is set - only useful on Windows
152155
if python_library and sysconfig.get_platform().startswith("win"):
153156
cache_config[f"{prefix}_LIBRARY"] = python_library
157+
if python_sabi_library and sysconfig.get_platform().startswith("win"):
158+
cache_config[f"{prefix}_SABI_LIBRARY"] = python_sabi_library
154159

155160
if limited_abi:
156161
cache_config["SKBUILD_SOABI"] = (

0 commit comments

Comments
 (0)