Skip to content

Commit 7af8187

Browse files
authored
feat: warn if cmake/ninja in build system requirements (#803)
Fix #780. Signed-off-by: Henry Schreiner <[email protected]>
1 parent 0e67e57 commit 7af8187

File tree

2 files changed

+26
-0
lines changed

2 files changed

+26
-0
lines changed

docs/configuration.md

+8
Original file line numberDiff line numberDiff line change
@@ -343,6 +343,13 @@ historic compatibility if you'd like:
343343
wheel.expand-macos-universal-tags = true
344344
```
345345

346+
347+
You can also specify a build tag:
348+
349+
```{conftabs} wheel.build-tag 1
350+
351+
```
352+
346353
You can select only specific components to install:
347354

348355
```{conftabs} install.components ["python"]
@@ -355,6 +362,7 @@ And you can turn off binary stripping:
355362
356363
```
357364

365+
358366
## Configuring CMake arguments and defines
359367

360368
You can select a different build type, such as `Debug`:

src/scikit_build_core/build/wheel.py

+18
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,9 @@
99
from pathlib import Path
1010
from typing import TYPE_CHECKING
1111

12+
from packaging.requirements import Requirement
13+
from packaging.utils import canonicalize_name
14+
1215
from .. import __version__
1316
from .._compat import tomllib
1417
from .._compat.typing import Literal, assert_never
@@ -139,12 +142,27 @@ def _build_wheel_impl(
139142

140143
settings_reader.validate_may_exit()
141144

145+
# Warn if cmake or ninja is in build-system.requires
146+
requirements = [
147+
canonicalize_name(Requirement(p).name)
148+
for p in pyproject.get("build-system", {}).get("requires", [])
149+
]
150+
if "cmake" in requirements:
151+
logger.warning(
152+
"cmake should not be in build-system.requires - scikit-build-core will inject it as needed"
153+
)
154+
if "ninja" in requirements:
155+
logger.warning(
156+
"ninja should not be in build-system.requires - scikit-build-core will inject it as needed"
157+
)
158+
142159
metadata = get_standard_metadata(pyproject, settings)
143160

144161
if metadata.version is None:
145162
msg = "project.version is not specified, must be statically present or tool.scikit-build metadata.version.provider configured when dynamic"
146163
raise AssertionError(msg)
147164

165+
# Get the closest (normally) importable name
148166
normalized_name = metadata.name.replace("-", "_").replace(".", "_")
149167

150168
if settings.wheel.cmake:

0 commit comments

Comments
 (0)