Skip to content

Commit 19b7782

Browse files
authored
fix: include 3.26.1 SABI fix (#227)
Missed earlier. Hitting bug: https://gitlab.kitware.com/cmake/cmake/-/issues/24610 --------- Signed-off-by: Henry Schreiner <[email protected]>
1 parent 0a1c77c commit 19b7782

File tree

16 files changed

+44
-38
lines changed

16 files changed

+44
-38
lines changed

.github/CONTRIBUTING.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -223,7 +223,7 @@ test = ["pytest>=6.0"]
223223
```
224224

225225
```cmake
226-
cmake_minimum_required(VERSION 3.15...3.25)
226+
cmake_minimum_required(VERSION 3.15...3.26)
227227
project("${SKBUILD_PROJECT_NAME}" LANGUAGES CXX VERSION "${SKBUILD_PROJECT_VERSION}")
228228
229229
find_package(pybind11 CONFIG REQUIRED)
@@ -266,7 +266,7 @@ build-backend = "scikit_build_core.setuptools.build_meta"
266266
```
267267

268268
```cmake
269-
cmake_minimum_required(VERSION 3.15...3.25)
269+
cmake_minimum_required(VERSION 3.15...3.26)
270270
project("${SKBUILD_PROJECT_NAME}" LANGUAGES CXX VERSION "${SKBUILD_PROJECT_VERSION}")
271271
272272
find_package(pybind11 CONFIG REQUIRED)

.github/workflows/ci.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ jobs:
5252
cmake-version: "3.21.x"
5353
- python-version: "3.11"
5454
runs-on: windows-2022
55-
cmake-version: "3.25.x"
55+
cmake-version: "3.26.x"
5656
- python-version: "pypy-3.7"
5757
runs-on: ubuntu-latest
5858
cmake-version: "3.15.x"

src/scikit_build_core/resources/find_python/FindPython/Support.cmake

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -498,7 +498,7 @@ function (_PYTHON_GET_CONFIG_VAR _PYTHON_PGCV_VALUE NAME)
498498
list (REMOVE_DUPLICATES _values)
499499
elseif (NAME STREQUAL "SOABI")
500500
# clean-up: remove prefix character and suffix
501-
if (_values MATCHES "^(\\.${CMAKE_SHARED_LIBRARY_SUFFIX}|\\.so|\\.pyd)$")
501+
if (_values MATCHES "^(${CMAKE_SHARED_LIBRARY_SUFFIX}|\\.so|\\.pyd)$")
502502
set(_values "")
503503
else()
504504
string (REGEX REPLACE "^[.-](.+)(${CMAKE_SHARED_LIBRARY_SUFFIX}|\\.(so|pyd))$" "\\1" _values "${_values}")
@@ -549,7 +549,7 @@ function (_PYTHON_GET_CONFIG_VAR _PYTHON_PGCV_VALUE NAME)
549549
else()
550550
if (_values)
551551
# clean-up: remove prefix character and suffix
552-
if (_values MATCHES "^(\\.${CMAKE_SHARED_LIBRARY_SUFFIX}|\\.so|\\.pyd)$")
552+
if (_values MATCHES "^(${CMAKE_SHARED_LIBRARY_SUFFIX}|\\.so|\\.pyd)$")
553553
set(_values "")
554554
else()
555555
string (REGEX REPLACE "^[.-](.+)(${CMAKE_SHARED_LIBRARY_SUFFIX}|\\.(so|pyd))$" "\\1" _values "${_values}")
@@ -576,7 +576,7 @@ function (_PYTHON_GET_CONFIG_VAR _PYTHON_PGCV_VALUE NAME)
576576
endforeach()
577577
if (_values)
578578
# clean-up: remove prefix character and suffix
579-
if (_values MATCHES "^(\\.${CMAKE_SHARED_LIBRARY_SUFFIX}|\\.so|\\.pyd)$")
579+
if (_values MATCHES "^(${CMAKE_SHARED_LIBRARY_SUFFIX}|\\.so|\\.pyd)$")
580580
set(_values "")
581581
else()
582582
string (REGEX REPLACE "^[.-](.+)(${CMAKE_SHARED_LIBRARY_SUFFIX}|\\.(so|pyd))$" "\\1" _values "${_values}")
@@ -585,7 +585,7 @@ function (_PYTHON_GET_CONFIG_VAR _PYTHON_PGCV_VALUE NAME)
585585
endif()
586586
endif()
587587
elseif (NAME STREQUAL "SOSABI")
588-
execute_process (COMMAND ${_${_PYTHON_PREFIX}_INTERPRETER_LAUNCHER} "${_${_PYTHON_PREFIX}_EXECUTABLE}" -c "import sys\nimport re\nimport importlib\nsys.stdout.write(next(filter(lambda x: re.search('^\\.abi', x), importlib.machinery.EXTENSION_SUFFIXES)))"
588+
execute_process (COMMAND ${_${_PYTHON_PREFIX}_INTERPRETER_LAUNCHER} "${_${_PYTHON_PREFIX}_EXECUTABLE}" -c "import sys\nimport re\nimport importlib.machinery\nsys.stdout.write(next(filter(lambda x: re.search('^\\.abi', x), importlib.machinery.EXTENSION_SUFFIXES)))"
589589
RESULT_VARIABLE _result
590590
OUTPUT_VARIABLE _values
591591
ERROR_QUIET
Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,15 @@
1-
cmake_minimum_required(VERSION 3.15...3.25)
1+
cmake_minimum_required(VERSION 3.15...3.26)
22

33
project(
44
${SKBUILD_PROJECT_NAME}
55
LANGUAGES C
66
VERSION ${SKBUILD_PROJECT_VERSION})
77

8-
find_package(Python COMPONENTS Interpreter Development.Module)
9-
set(Python_SOABI ${SKBUILD_SOABI})
8+
find_package(
9+
Python
10+
COMPONENTS Interpreter Development.SABIModule
11+
REQUIRED)
1012

11-
python_add_library(abi3_example MODULE abi3_example.c WITH_SOABI)
13+
python_add_library(abi3_example MODULE abi3_example.c WITH_SOABI USE_SABI 3.7)
1214

1315
install(TARGETS abi3_example DESTINATION .)

tests/packages/abi3_pyproject_ext/abi3_example.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
#define Py_LIMITED_API 0x03070000
21
#define PY_SSIZE_T_CLEAN
32
#include <Python.h>
43

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,15 @@
1-
cmake_minimum_required(VERSION 3.15...3.25)
1+
cmake_minimum_required(VERSION 3.15...3.26)
22

33
project(
44
${SKBUILD_PROJECT_NAME}
55
LANGUAGES C
66
VERSION ${SKBUILD_PROJECT_VERSION})
77

8-
find_package(Python COMPONENTS Interpreter Development.Module)
9-
set(Python_SOABI ${SKBUILD_SOABI})
8+
find_package(
9+
Python
10+
COMPONENTS Interpreter Development.SABIModule
11+
REQUIRED)
1012

11-
python_add_library(abi3_example MODULE abi3_example.c WITH_SOABI)
13+
python_add_library(abi3_example MODULE abi3_example.c WITH_SOABI USE_SABI 3.7)
1214

1315
install(TARGETS abi3_example DESTINATION .)

tests/packages/abi3_setuptools_ext/abi3_example.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
#define Py_LIMITED_API 0x03070000
21
#define PY_SSIZE_T_CLEAN
32
#include <Python.h>
43

tests/packages/filepath_pure/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
cmake_minimum_required(VERSION 3.15...3.25)
1+
cmake_minimum_required(VERSION 3.15...3.26)
22
project(
33
"${SKBUILD_PROJECT_NAME}"
44
LANGUAGES C

tests/packages/simple_pure/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
cmake_minimum_required(VERSION 3.15...3.25)
1+
cmake_minimum_required(VERSION 3.15...3.26)
22

33
project(simple_pure LANGUAGES CXX)
44

tests/packages/simple_pyproject_ext/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
cmake_minimum_required(VERSION 3.15...3.25)
1+
cmake_minimum_required(VERSION 3.15...3.26)
22
project(
33
"${SKBUILD_PROJECT_NAME}"
44
LANGUAGES CXX

tests/packages/simple_setuptools_ext/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
cmake_minimum_required(VERSION 3.15...3.25)
1+
cmake_minimum_required(VERSION 3.15...3.26)
22
project(
33
"${SKBUILD_PROJECT_NAME}"
44
LANGUAGES CXX

tests/packages/simplest_c/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
cmake_minimum_required(VERSION 3.15...3.25)
1+
cmake_minimum_required(VERSION 3.15...3.26)
22

33
project(
44
${SKBUILD_PROJECT_NAME}

tests/test_pyproject_abi3.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import shutil
22
import sys
3+
import sysconfig
34
import zipfile
45
from pathlib import Path
56

@@ -9,6 +10,7 @@
910

1011
DIR = Path(__file__).parent.resolve()
1112
ABI_PKG = DIR / "packages/abi3_pyproject_ext"
13+
SYSCONFIGPLAT = sysconfig.get_platform()
1214

1315

1416
@pytest.mark.compile()
@@ -17,8 +19,8 @@
1719
sys.implementation.name == "pypy", reason="pypy does not support abi3"
1820
)
1921
@pytest.mark.skipif(
20-
sys.platform.startswith("win"),
21-
reason="abi3 is hard to target with FindPython on Windows",
22+
SYSCONFIGPLAT.startswith(("msys", "mingw")),
23+
reason="abi3 FindPython on MSYS/MinGW reports not found",
2224
)
2325
def test_abi3_wheel(tmp_path, monkeypatch, virtualenv):
2426
dist = tmp_path / "dist"

tests/test_pyproject_pep517.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -80,11 +80,11 @@ def test_pep517_sdist_hash(tmp_path, monkeypatch):
8080
hash = hashlib.sha256(sdist.read_bytes()).hexdigest()
8181
if sys.version_info < (3, 9):
8282
assert (
83-
hash == "3b4af3fbe3d4505415bb1e55bb2e49902f4633d371ae7288007d90eb1488bc4d"
83+
hash == "f1b86c7fbcc70ed82786fd3446caf880091096b7d6c0085eab8fe64466b95c4f"
8484
)
8585
else:
8686
assert (
87-
hash == "d373b8458ee37b176cfd03f0f3199b30fdb034bca465b2826392a6c3af85ca4c"
87+
hash == "463bdfcfad8b71a0f2b48b7b5abea191c9073170326183c04b7f23da19d6b61b"
8888
)
8989

9090

@@ -158,11 +158,11 @@ def each_unignored_file_ordered(*args, **kwargs):
158158
hash = hashlib.sha256(sdist.read_bytes()).hexdigest()
159159
if sys.version_info < (3, 9):
160160
assert (
161-
hash == "99d54d3090f932f00b77f01d12d422aacb674a6a9afd6af24f7afaaab7c3082b"
161+
hash == "9e4713843829659b4862e73c8a9ae783178d620a78fed1f757efb82ea77ff82f"
162162
)
163163
else:
164164
assert (
165-
hash == "359e38eb01415440cc8f7d9ee09612d625b8906ca09cd08c9d56f3eb972b0110"
165+
hash == "aa1f2cd959998cb58316f72526ad7b2d3078bf47d00c5c9f8903d9b5980c0e35"
166166
)
167167

168168

tests/test_pyproject_pep518.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,12 +40,12 @@ def test_pep518_sdist():
4040
if sys.version_info < (3, 9):
4141
assert (
4242
hash
43-
== "3b4af3fbe3d4505415bb1e55bb2e49902f4633d371ae7288007d90eb1488bc4d"
43+
== "f1b86c7fbcc70ed82786fd3446caf880091096b7d6c0085eab8fe64466b95c4f"
4444
)
4545
else:
4646
assert (
4747
hash
48-
== "d373b8458ee37b176cfd03f0f3199b30fdb034bca465b2826392a6c3af85ca4c"
48+
== "463bdfcfad8b71a0f2b48b7b5abea191c9073170326183c04b7f23da19d6b61b"
4949
)
5050

5151
with tarfile.open(sdist) as f:

tests/test_setuptools_abi3.py

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import shutil
22
import sys
3+
import sysconfig
34
import zipfile
45
from pathlib import Path
56

@@ -11,6 +12,7 @@
1112

1213
DIR = Path(__file__).parent.resolve()
1314
ABI_PKG = DIR / "packages/abi3_setuptools_ext"
15+
SYSCONFIGPLAT = sysconfig.get_platform()
1416

1517

1618
@pytest.mark.compile()
@@ -19,8 +21,8 @@
1921
sys.implementation.name == "pypy", reason="pypy does not support abi3"
2022
)
2123
@pytest.mark.skipif(
22-
sys.platform.startswith("win"),
23-
reason="abi3 is hard to target with FindPython on Windows",
24+
SYSCONFIGPLAT.startswith(("msys", "mingw")),
25+
reason="abi3 FindPython on MSYS/MinGW reports not found",
2426
)
2527
def test_abi3_wheel(tmp_path, monkeypatch, virtualenv):
2628
dist = tmp_path / "dist"
@@ -46,12 +48,12 @@ def test_abi3_wheel(tmp_path, monkeypatch, virtualenv):
4648
p = zipfile.Path(f)
4749
file_names = {p.name for p in p.iterdir()}
4850

49-
so_file = (
50-
"abi3_example.abi3.dll"
51-
if sys.platform.startswith("cygwin")
52-
else "abi3_example.abi3.so"
53-
)
54-
assert so_file in file_names
51+
if sys.platform.startswith("win"):
52+
assert "abi3_example.pyd" in file_names
53+
elif sys.platform.startswith("cygwin"):
54+
assert "abi3_example.abi3.dll" in file_names
55+
else:
56+
assert "abi3_example.abi3.so" in file_names
5557

5658
virtualenv.install(wheel)
5759

0 commit comments

Comments
 (0)