Skip to content

Commit 614c818

Browse files
authored
tests: clear CMAKE_GENERATOR (#141)
Should allow conda-forge to reenable this test. Adding a little more debug logging. Signed-off-by: Henry Schreiner <[email protected]>
1 parent 4cfa597 commit 614c818

File tree

3 files changed

+26
-1
lines changed

3 files changed

+26
-1
lines changed

docs/changelog.md

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,17 @@
11
# Changelog
22

3+
### What's Changed
4+
5+
Fixes:
6+
7+
- Windows non-default generators by @henryiii in #137
8+
- Compute the correct default generator for CMake by @henryiii in #139
9+
10+
Testing:
11+
12+
- Support make missing by @henryiii in #140
13+
- Clear `CMAKE_GENERATOR` by @henryiii in #141
14+
315
## Version 0.1.0
416

517
First non-prerelease! Scikit-build-core is ready to be used. The remaining
@@ -12,7 +24,7 @@ released.
1224

1325
Still preparing for release. One small addition to the error printout.
1426

15-
# ## What's Changed
27+
### What's Changed
1628

1729
Features:
1830

src/scikit_build_core/builder/get_requires.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111

1212
from .._compat import tomllib
1313
from .._compat.typing import Literal
14+
from .._logging import logger
1415
from ..program_search import (
1516
best_program,
1617
get_cmake_programs,
@@ -54,6 +55,8 @@ def cmake_ninja_for_build_wheel(
5455
cmake = best_program(get_cmake_programs(module=False), minimum_version=cmake_min)
5556
if cmake is None:
5657
packages.append(f"cmake>={cmake_min}")
58+
else:
59+
logger.debug("Found system CMake: {} - not requiring PyPI package", cmake)
5760

5861
if (
5962
not sys.platform.startswith("win")
@@ -71,5 +74,11 @@ def cmake_ninja_for_build_wheel(
7174
or not list(get_make_programs())
7275
):
7376
packages.append(f"ninja>={ninja_min}")
77+
else:
78+
logger.debug(
79+
"Found system Make & not on known platform - not requiring PyPI package for Ninja"
80+
)
81+
else:
82+
logger.debug("Found system Ninja: {} - not requiring PyPI package", ninja)
7483

7584
return packages

tests/test_get_requires.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,20 +21,23 @@ def which_mock(name: str) -> str | None:
2121
def test_get_requires_for_build_wheel(fp, monkeypatch):
2222
cmake = Path("cmake/path").resolve()
2323
monkeypatch.setattr(shutil, "which", which_mock)
24+
monkeypatch.delenv("CMAKE_GENERATOR", raising=False)
2425
fp.register([os.fspath(cmake), "--version"], stdout="3.14.0")
2526
assert cmake_ninja_for_build_wheel() == ["cmake>=3.15", *ninja]
2627

2728

2829
def test_get_requires_for_build_wheel_uneeded(fp, monkeypatch):
2930
cmake = Path("cmake/path").resolve()
3031
monkeypatch.setattr(shutil, "which", which_mock)
32+
monkeypatch.delenv("CMAKE_GENERATOR", raising=False)
3133
fp.register([os.fspath(cmake), "--version"], stdout="3.18.0")
3234
assert cmake_ninja_for_build_wheel() == [*ninja]
3335

3436

3537
def test_get_requires_for_build_wheel_settings(fp, monkeypatch):
3638
cmake = Path("cmake/path").resolve()
3739
monkeypatch.setattr(shutil, "which", which_mock)
40+
monkeypatch.delenv("CMAKE_GENERATOR", raising=False)
3841
fp.register([os.fspath(cmake), "--version"], stdout="3.18.0")
3942
config = {"cmake.minimum-version": "3.20"}
4043
assert cmake_ninja_for_build_wheel(config) == [
@@ -53,5 +56,6 @@ def test_get_requires_for_build_wheel_pyproject(fp, monkeypatch, tmp_path):
5356
)
5457
cmake = Path("cmake/path").resolve()
5558
monkeypatch.setattr(shutil, "which", which_mock)
59+
monkeypatch.delenv("CMAKE_GENERATOR", raising=False)
5660
fp.register([os.fspath(cmake), "--version"], stdout="3.18.0")
5761
assert cmake_ninja_for_build_wheel() == ["cmake>=3.21", *ninja]

0 commit comments

Comments
 (0)