Skip to content

Commit 406766f

Browse files
committed
fix: build from sources when forcing build from source
1 parent bf388ce commit 406766f

File tree

3 files changed

+26
-4
lines changed

3 files changed

+26
-4
lines changed

.github/workflows/build.yml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -128,8 +128,11 @@ jobs:
128128
name: cibw-sdist
129129
path: sdist
130130

131+
- name: Ensure Ninja not present on the system
132+
run: if which ninja; then false; fi
133+
131134
- name: Install SDist
132-
run: pip install $(ls sdist/*.tar.gz)[test] -Ccmake.define.BUILD_CMAKE_FROM_SOURCE=OFF
135+
run: pip install --no-binary=ninja $(ls sdist/*.tar.gz)[test] -Ccmake.define.BUILD_CMAKE_FROM_SOURCE=OFF
133136

134137
- name: Test installed SDist
135138
run: pip check && pytest ./tests

_build_backend/backend.py

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
from scikit_build_core import build as _orig
2+
3+
prepare_metadata_for_build_wheel = _orig.prepare_metadata_for_build_wheel
4+
build_wheel = _orig.build_wheel
5+
build_sdist = _orig.build_sdist
6+
get_requires_for_build_sdist = _orig.get_requires_for_build_sdist
7+
8+
def get_requires_for_build_wheel(config_settings=None):
9+
packages_orig = _orig.get_requires_for_build_wheel(config_settings)
10+
packages = []
11+
for package in packages_orig:
12+
package_name = package.lower().split(">")[0].strip()
13+
if package_name == "ninja":
14+
# never request ninja from the ninja build
15+
continue
16+
packages.append(package)
17+
return packages

pyproject.toml

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
[build-system]
2-
requires = ["scikit-build-core"]
3-
build-backend = "scikit_build_core.build"
2+
requires = ["scikit-build-core>=0.10"]
3+
build-backend = "backend"
4+
backend-path = ["_build_backend"]
45

56
[project]
67
name = "ninja"
@@ -50,7 +51,8 @@ Homepage = "http://ninja-build.org/"
5051
"Source Code" = "https://github.com/scikit-build/ninja-python-distributions"
5152

5253
[tool.scikit-build]
53-
minimum-version = "0.9"
54+
minimum-version = "build-system.requires"
55+
ninja.make-fallback = true
5456
build-dir = "build/{wheel_tag}"
5557
wheel.py-api = "py3"
5658
wheel.expand-macos-universal-tags = true

0 commit comments

Comments
 (0)