diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 40f8b3a..920298d 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -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] -Ccmake.define.BUILD_CMAKE_FROM_SOURCE=OFF - name: Test installed SDist run: pip check && pytest ./tests diff --git a/_build_backend/backend.py b/_build_backend/backend.py new file mode 100644 index 0000000..2d50f85 --- /dev/null +++ b/_build_backend/backend.py @@ -0,0 +1,17 @@ +from scikit_build_core import build as _orig + +prepare_metadata_for_build_wheel = _orig.prepare_metadata_for_build_wheel +build_wheel = _orig.build_wheel +build_sdist = _orig.build_sdist +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) + 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 diff --git a/pyproject.toml b/pyproject.toml index cee25bc..d9c469e 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -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" @@ -50,7 +51,8 @@ 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" +ninja.make-fallback = true build-dir = "build/{wheel_tag}" wheel.py-api = "py3" wheel.expand-macos-universal-tags = true