Skip to content

Commit 5f068d5

Browse files
mayeuthenryiiijcfr
authored
chore(build): move to scikitbuild-core (scikit-build#455)
* Maintain support for testing wheels for Python 2.7 & 3.5 (on Windows) by adding the `test_old_pythons` GitHub workflow job. * Drop support for building sdist on Python 2.7 and 3.6 * Add support for editable install with Python >= 3.4 using the default "redirect" mode. * Add support for building and testing Python 3.x wheels using Python 3.12. * Update GitHub workflow macOS runner from `macos-11` to `macos-14`. Co-authored-by: Henry Schreiner <[email protected]> Co-authored-by: Jean-Christophe Fillion-Robin <[email protected]>
1 parent e7903d4 commit 5f068d5

File tree

16 files changed

+164
-368
lines changed

16 files changed

+164
-368
lines changed

.github/workflows/build.yml

Lines changed: 66 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ env:
2727
jobs:
2828
lint:
2929
name: Lint
30-
runs-on: ubuntu-22.04
30+
runs-on: ubuntu-latest
3131
steps:
3232
- uses: actions/checkout@v4
3333
- uses: actions/setup-python@v5
@@ -44,43 +44,43 @@ jobs:
4444
fail-fast: false
4545
matrix:
4646
include:
47-
- os: ubuntu-22.04
47+
- os: ubuntu-latest
4848
arch: "x86_64"
4949
build: "manylinux_"
5050
use_qemu: false
51-
- os: ubuntu-22.04
51+
- os: ubuntu-latest
5252
arch: "x86_64"
5353
build: "musllinux_"
5454
use_qemu: false
55-
- os: ubuntu-22.04
55+
- os: ubuntu-latest
5656
arch: "i686"
5757
build: "manylinux_"
5858
use_qemu: false
59-
- os: ubuntu-22.04
59+
- os: ubuntu-latest
6060
arch: "i686"
6161
build: "musllinux_"
6262
use_qemu: false
63-
- os: ubuntu-22.04
63+
- os: ubuntu-latest
6464
arch: "aarch64"
6565
build: "manylinux_"
6666
use_qemu: true
67-
- os: ubuntu-22.04
67+
- os: ubuntu-latest
6868
arch: "aarch64"
6969
build: "musllinux_"
7070
use_qemu: true
71-
- os: ubuntu-22.04
71+
- os: ubuntu-latest
7272
arch: "ppc64le"
7373
build: "manylinux_"
7474
use_qemu: true
75-
- os: ubuntu-22.04
75+
- os: ubuntu-latest
7676
arch: "ppc64le"
7777
build: "musllinux_"
7878
use_qemu: true
79-
- os: ubuntu-22.04
79+
- os: ubuntu-latest
8080
arch: "s390x"
8181
build: "manylinux_"
8282
use_qemu: true
83-
- os: ubuntu-22.04
83+
- os: ubuntu-latest
8484
arch: "s390x"
8585
build: "musllinux_"
8686
use_qemu: true
@@ -96,8 +96,8 @@ jobs:
9696
arch: "x86"
9797
build: ""
9898
use_qemu: false
99-
- os: macos-11
100-
arch: "x86_64"
99+
- os: macos-14
100+
arch: "universal2"
101101
build: ""
102102
use_qemu: false
103103

@@ -121,13 +121,13 @@ jobs:
121121
- uses: actions/upload-artifact@v4
122122
if: (!matrix.use_qemu) || fromJSON(env.USE_QEMU)
123123
with:
124-
name: Wheel-${{ matrix.os }}-${{ matrix.build }}${{ matrix.arch }}
124+
name: Wheel-${{ runner.os }}-${{ matrix.build }}${{ matrix.arch }}
125125
path: ./wheelhouse/*.whl
126126

127127
build_manylinux2010_wheels:
128128
name: Build ${{ matrix.arch }} manylinux2010 wheels
129129
needs: [lint]
130-
runs-on: ubuntu-22.04
130+
runs-on: ubuntu-latest
131131
strategy:
132132
fail-fast: false
133133
matrix:
@@ -153,10 +153,53 @@ jobs:
153153
name: Wheel-manylinux2010-${{ matrix.arch }}
154154
path: ./wheelhouse/*.whl
155155

156+
test_old_pythons:
157+
name: Test wheel with python ${{ matrix.python }}
158+
needs: [build_wheels]
159+
runs-on: windows-latest
160+
strategy:
161+
fail-fast: false
162+
matrix:
163+
python: ["2.7", "3.5"]
164+
steps:
165+
- uses: actions/checkout@v4
166+
- uses: actions/setup-python@v5
167+
if: matrix.python != '2.7'
168+
name: Install Python ${{ matrix.python }}
169+
with:
170+
python-version: ${{ matrix.python }}
171+
172+
- name: Install Python ${{ matrix.python }}
173+
if: matrix.python == '2.7'
174+
shell: bash
175+
run: |
176+
nuget install python2 -Version 2.7.18 -OutputDirectory '${{ runner.temp }}'
177+
echo '${{ runner.temp }}\python2.2.7.18\tools' >> $GITHUB_PATH
178+
179+
- name: Install dependencies
180+
shell: bash
181+
run: |
182+
python -m pip install -U pip
183+
python -m pip install pytest pytest-cov
184+
185+
- uses: actions/download-artifact@v4
186+
with:
187+
name: Wheel-Windows-AMD64
188+
path: wheelhouse
189+
190+
- name: Install wheel
191+
shell: bash
192+
run: |
193+
python -m pip -V
194+
python -m pip install "$(find wheelhouse -name '*.whl')[test]"
195+
196+
- name: Test installed SDist
197+
run: python -m pytest ./tests
198+
156199
build_sdist:
157200
name: Build source distribution
158201
needs: [lint]
159-
runs-on: ubuntu-22.04
202+
runs-on: ubuntu-latest
160203
steps:
161204
- uses: actions/checkout@v4
162205
with:
@@ -173,36 +216,24 @@ jobs:
173216
test_sdist:
174217
name: Test SDist with python ${{ matrix.python }}
175218
needs: [build_sdist]
176-
# 22.04 doesn't have 2.7 or 3.6
177-
runs-on: ubuntu-20.04
219+
runs-on: ubuntu-latest
178220
strategy:
179221
fail-fast: false
180222
matrix:
181-
python: ["2.7", "3.6", "3.12"]
223+
python: ["3.7", "3.12"]
182224

183225
steps:
184226
- uses: actions/checkout@v4
185227
- uses: actions/setup-python@v5
186-
if: matrix.python != '2.7'
187228
name: Install Python ${{ matrix.python }}
188229
with:
189230
python-version: ${{ matrix.python }}
190231

191-
- name: Install Ubuntu Python 2.7
192-
if: matrix.python == '2.7'
193-
run: |
194-
sudo apt-get update
195-
sudo apt-get install -y --no-install-recommends python2 python3-virtualenv
196-
virtualenv -p python2 ${HOME}/cp27
197-
${HOME}/cp27/bin/python -m pip install -U pip
198-
${HOME}/cp27/bin/python -m pip install -U setuptools wheel
199-
echo "${HOME}/cp27/bin" >> $GITHUB_PATH
200-
201232
- name: Install dependencies
202233
run: |
203234
sudo apt-get update
204235
sudo apt-get install -y --no-install-recommends libssl-dev
205-
pip install -r requirements-test.txt
236+
pip install pytest pytest-cov
206237
207238
- uses: actions/download-artifact@v4
208239
with:
@@ -211,8 +242,9 @@ jobs:
211242

212243
- name: Install SDist
213244
env:
214-
SKBUILD_CONFIGURE_OPTIONS: "-DBUILD_CMAKE_FROM_SOURCE:BOOL=OFF"
245+
CMAKE_ARGS: "-DBUILD_CMAKE_FROM_SOURCE:BOOL=OFF"
215246
run: |
247+
pip -V
216248
pip install dist/*.tar.gz
217249
rm -rf dist
218250
@@ -221,8 +253,8 @@ jobs:
221253

222254
check_dist:
223255
name: Check dist
224-
needs: [build_wheels, build_manylinux2010_wheels, build_sdist, test_sdist]
225-
runs-on: ubuntu-22.04
256+
needs: [build_wheels, build_manylinux2010_wheels, test_old_pythons, build_sdist, test_sdist]
257+
runs-on: ubuntu-latest
226258
steps:
227259
- uses: actions/download-artifact@v4
228260
with:

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ develop-eggs
3030
.installed.cfg
3131
lib
3232
lib64
33+
wheelhouse
3334

3435
# Installer logs
3536
pip-log.txt

CMakeLists.txt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -460,5 +460,4 @@ include\(\"${CMakeProject_BINARY_DIR}/cmake_install.cmake\")
460460
install(${type} ${file} DESTINATION "${relative_directory}" ${_permissions})
461461
endforeach()
462462
endif()
463-
464463
endif()

MANIFEST.in

Lines changed: 0 additions & 15 deletions
This file was deleted.

constraints-ci.txt

Lines changed: 0 additions & 2 deletions
This file was deleted.

pyproject.toml

Lines changed: 62 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,54 +1,95 @@
11
[build-system]
2-
requires = [
3-
"scikit-build>=0.12",
4-
"setuptools>=42",
5-
"setuptools-scm[toml]",
2+
requires = ["scikit-build-core"]
3+
build-backend = "scikit_build_core.build"
4+
5+
[project]
6+
name = "cmake"
7+
description = "CMake is an open-source, cross-platform family of tools designed to build, test and package software"
8+
keywords = ["CMake", "build", "c++", "fortran", "cross-platform", "cross-compilation"]
9+
readme = "README.rst"
10+
license = {text = "Apache 2.0"}
11+
authors = [
12+
{name = "Jean-Christophe Fillion-Robin", email = "[email protected]"},
13+
]
14+
classifiers = [
15+
"License :: OSI Approved :: Apache Software License",
16+
"License :: OSI Approved :: BSD License",
17+
"Programming Language :: C",
18+
"Programming Language :: C++",
19+
"Programming Language :: Fortran",
20+
"Programming Language :: Python",
21+
"Operating System :: OS Independent",
22+
"Development Status :: 5 - Production/Stable",
23+
"Intended Audience :: Developers",
24+
"Topic :: Software Development :: Build Tools",
25+
"Typing :: Typed"
26+
]
27+
dynamic = ["version"]
28+
# requires-python = ">=3.7" this is only required to build the wheel. We're still compatible with python 2.7
29+
30+
[project.urls]
31+
Homepage = "https://cmake.org"
32+
Documentation = "https://cmake-python-distributions.readthedocs.io"
33+
Source = "ttps://github.com/scikit-build/cmake-python-distributions"
34+
"Mailing list" = "https://groups.google.com/forum/#!forum/scikit-build"
35+
"Bug Tracker" = "https://github.com/scikit-build/cmake-python-distributions/issues"
36+
37+
[project.optional-dependencies]
38+
test = [
39+
"coverage>=4.2",
40+
"importlib_metadata>=2.0; python_version<'3.10'",
41+
"pytest>=3.0.3",
42+
"pytest-cov>=2.4.0",
643
]
7-
build-backend = "setuptools.build_meta"
44+
45+
[project.scripts]
46+
cmake = "cmake:cmake"
47+
cpack = "cmake:cpack"
48+
ctest = "cmake:ctest"
49+
50+
[tool.scikit-build]
51+
minimum-version = "0.8"
52+
build-dir = "build/{wheel_tag}"
53+
metadata.version.provider = "scikit_build_core.metadata.setuptools_scm"
54+
ninja.make-fallback = false
55+
sdist.include = ["src/cmake/_version.py"]
56+
wheel.py-api = "py2.py3"
57+
wheel.expand-macos-universal-tags = true
58+
wheel.install-dir = "cmake/data"
859

960
[tool.setuptools_scm]
1061
write_to = "src/cmake/_version.py"
62+
# Setuptools-scm includes type annotations in the default template
63+
write_to_template = "version = '{version}'"
1164

1265
[tool.cibuildwheel]
1366
build = "cp39-*"
14-
before-all = [
15-
'pipx install -f --pip-args="-c {project}/constraints-ci.txt" cmake',
16-
'cmake --version',
17-
'pipx install -f --pip-args="-c {project}/constraints-ci.txt" ninja',
18-
'ninja --version',
19-
]
20-
before-build = "pip install -r requirements-repair.txt"
21-
repair-wheel-command = "python scripts/repair_wheel.py -w {dest_dir} {wheel}"
2267
test-extras = "test"
2368
test-command = "pytest {project}/tests"
2469
build-verbosity = 1
2570

2671
[tool.cibuildwheel.linux]
2772
before-all = [
28-
'pipx install -f --pip-args="-c {project}/constraints-ci.txt" cmake',
29-
'cmake --version',
30-
'pipx install -f --pip-args="-c {project}/constraints-ci.txt" ninja',
31-
'ninja --version',
3273
'./scripts/manylinux-build-and-install-openssl.sh',
3374
]
34-
environment = { SKBUILD_CONFIGURE_OPTIONS = "-DOPENSSL_ROOT_DIR:PATH=/usr/local/ssl -DCMAKE_JOB_POOL_COMPILE:STRING=compile -DCMAKE_JOB_POOL_LINK:STRING=link -DCMAKE_JOB_POOLS:STRING=compile=4;link=1 -DCMAKE_CXX_STANDARD:STRING=11" }
75+
environment = { CMAKE_ARGS = "-DOPENSSL_ROOT_DIR:PATH=/usr/local/ssl -DCMAKE_JOB_POOL_COMPILE:STRING=compile -DCMAKE_JOB_POOL_LINK:STRING=link -DCMAKE_JOB_POOLS:STRING=compile=4;link=1 -DCMAKE_CXX_STANDARD:STRING=11" }
3576

3677
[[tool.cibuildwheel.overrides]]
3778
select = ["*-manylinux_aarch64", "*-manylinux_ppc64le", "*-manylinux_s390x"]
3879
# disable tests on those platforms, QEMU is taking to long for jobs to pass on GHA
39-
environment = { SKBUILD_CONFIGURE_OPTIONS = "-DOPENSSL_ROOT_DIR:PATH=/usr/local/ssl -DCMAKE_JOB_POOL_COMPILE:STRING=compile -DCMAKE_JOB_POOL_LINK:STRING=link -DCMAKE_JOB_POOLS:STRING=compile=4;link=1 -DCMAKE_CXX_STANDARD:STRING=11 -DRUN_CMAKE_TEST:BOOL=OFF" }
80+
environment = { CMAKE_ARGS = "-DOPENSSL_ROOT_DIR:PATH=/usr/local/ssl -DCMAKE_JOB_POOL_COMPILE:STRING=compile -DCMAKE_JOB_POOL_LINK:STRING=link -DCMAKE_JOB_POOLS:STRING=compile=4;link=1 -DCMAKE_CXX_STANDARD:STRING=11 -DRUN_CMAKE_TEST:BOOL=OFF" }
4081

4182
[[tool.cibuildwheel.overrides]]
4283
select = ["*-musllinux_x86_64", "*-musllinux_i686"]
4384
# disable some tests
4485
# - BootstrapTest fails with custom OpenSSL and probably does not make much sense for this project
4586
# - ExportImport|RunCMake.install|RunCMake.file-GET_RUNTIME_DEPENDENCIES: c.f. https://discourse.cmake.org/t/cmake-test-suite-failing-on-alpine-linux/5064
46-
environment = { SKBUILD_CONFIGURE_OPTIONS = "-DOPENSSL_ROOT_DIR:PATH=/usr/local/ssl -DCMAKE_JOB_POOL_COMPILE:STRING=compile -DCMAKE_JOB_POOL_LINK:STRING=link -DCMAKE_JOB_POOLS:STRING=compile=4;link=1 -DRUN_CMAKE_TEST_EXCLUDE:STRING='BootstrapTest|ExportImport|RunCMake.install|RunCMake.file-GET_RUNTIME_DEPENDENCIES'" }
87+
environment = { CMAKE_ARGS = "-DOPENSSL_ROOT_DIR:PATH=/usr/local/ssl -DCMAKE_JOB_POOL_COMPILE:STRING=compile -DCMAKE_JOB_POOL_LINK:STRING=link -DCMAKE_JOB_POOLS:STRING=compile=4;link=1 -DRUN_CMAKE_TEST_EXCLUDE:STRING='BootstrapTest|ExportImport|RunCMake.install|RunCMake.file-GET_RUNTIME_DEPENDENCIES'" }
4788

4889
[[tool.cibuildwheel.overrides]]
4990
select = ["*-musllinux_aarch64", "*-musllinux_ppc64le", "*-musllinux_s390x"]
5091
# disable tests on those platforms, QEMU is taking to long for jobs to pass on GHA
51-
environment = { SKBUILD_CONFIGURE_OPTIONS = "-DOPENSSL_ROOT_DIR:PATH=/usr/local/ssl -DCMAKE_JOB_POOL_COMPILE:STRING=compile -DCMAKE_JOB_POOL_LINK:STRING=link -DCMAKE_JOB_POOLS:STRING=compile=4;link=1 -DRUN_CMAKE_TEST:BOOL=OFF" }
92+
environment = { CMAKE_ARGS = "-DOPENSSL_ROOT_DIR:PATH=/usr/local/ssl -DCMAKE_JOB_POOL_COMPILE:STRING=compile -DCMAKE_JOB_POOL_LINK:STRING=link -DCMAKE_JOB_POOLS:STRING=compile=4;link=1 -DRUN_CMAKE_TEST:BOOL=OFF" }
5293

5394
[tool.cibuildwheel.macos.environment]
5495
MACOSX_DEPLOYMENT_TARGET = "10.10"

requirements-dev.txt

Lines changed: 0 additions & 2 deletions
This file was deleted.

requirements-repair.txt

Lines changed: 0 additions & 1 deletion
This file was deleted.

requirements-test.txt

Lines changed: 0 additions & 4 deletions
This file was deleted.

0 commit comments

Comments
 (0)