Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -128,8 +128,11 @@ jobs:
name: cibw-sdist
path: sdist

- name: Ensure Ninja not present on the system
run: if which ninja; then false; fi

- name: Install SDist
run: pip install $(ls sdist/*.tar.gz)[test] -Ccmake.define.BUILD_CMAKE_FROM_SOURCE=OFF
run: pip install --no-binary=ninja $(ls sdist/*.tar.gz)[test]

- name: Test installed SDist
run: pip check && pytest ./tests
Expand Down
28 changes: 28 additions & 0 deletions _build_backend/backend.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
from __future__ import annotations

import os

from scikit_build_core import build as _orig

if hasattr(_orig, "prepare_metadata_for_build_editable"):
prepare_metadata_for_build_editable = _orig.prepare_metadata_for_build_editable
if hasattr(_orig, "prepare_metadata_for_build_wheel"):
prepare_metadata_for_build_wheel = _orig.prepare_metadata_for_build_wheel
build_editable = _orig.build_editable
build_wheel = _orig.build_wheel
build_sdist = _orig.build_sdist
get_requires_for_build_editable = _orig.get_requires_for_build_editable
get_requires_for_build_sdist = _orig.get_requires_for_build_sdist

def get_requires_for_build_wheel(config_settings=None):
packages_orig = _orig.get_requires_for_build_wheel(config_settings)
if os.environ.get("NINJA_PYTHON_DIST_ALLOW_NINJA_DEP", "0") != "0":
return packages_orig
packages = []
for package in packages_orig:
package_name = package.lower().split(">")[0].strip()
if package_name == "ninja":
# never request ninja from the ninja build
continue
packages.append(package)
return packages
18 changes: 13 additions & 5 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
[build-system]
requires = ["scikit-build-core"]
build-backend = "scikit_build_core.build"
requires = ["scikit-build-core>=0.10"]
build-backend = "backend"
backend-path = ["_build_backend"]

[project]
name = "ninja"
Expand Down Expand Up @@ -50,7 +51,9 @@ Homepage = "http://ninja-build.org/"
"Source Code" = "https://github.com/scikit-build/ninja-python-distributions"

[tool.scikit-build]
minimum-version = "0.9"
minimum-version = "build-system.requires"
cmake.version = "CMakeLists.txt" # Force parsing version from CMakeLists.txt and disable fallback to '>=3.15'
ninja.make-fallback = true
build-dir = "build/{wheel_tag}"
wheel.py-api = "py3"
wheel.expand-macos-universal-tags = true
Expand Down Expand Up @@ -88,6 +91,7 @@ build-verbosity = 1
test-extras = "test"
test-command = "pytest {project}/tests"
test-skip = ["*-win_arm64", "*-macosx_universal2:arm64"]
environment = { NINJA_PYTHON_DIST_ALLOW_NINJA_DEP = "1" }
environment-pass = ["SETUPTOOLS_SCM_PRETEND_VERSION"]
musllinux-x86_64-image = "musllinux_1_1"
musllinux-i686-image = "musllinux_1_1"
Expand All @@ -96,20 +100,24 @@ musllinux-ppc64le-image = "musllinux_1_1"
musllinux-s390x-image = "musllinux_1_1"
musllinux-armv7l-image = "musllinux_1_2"

[tool.cibuildwheel.macos.environment]
MACOSX_DEPLOYMENT_TARGET = "10.9"
[[tool.cibuildwheel.overrides]]
select = "*-macos*"
inherit.environment = "append"
environment = { MACOSX_DEPLOYMENT_TARGET = "10.9" }

[[tool.cibuildwheel.overrides]]
select = "*-manylinux_{x86_64,i686}"
manylinux-x86_64-image = "manylinux2010"
manylinux-i686-image = "manylinux2010"
build-frontend = "pip"
inherit.environment = "append"
environment = { LDFLAGS = "-static-libstdc++" }
inherit.test-command = "prepend"
test-command = "pip check"

[[tool.cibuildwheel.overrides]]
select = "*-musllinux_*"
inherit.environment = "append"
environment = { LDFLAGS = "-static-libstdc++ -static-libgcc" }

[[tool.cibuildwheel.overrides]]
Expand Down
Loading