Skip to content

Commit 3f6d39e

Browse files
authored
fix: avoid resolving cmake/ninja paths (#183)
Addresses #170. Signed-off-by: Henry Schreiner <[email protected]>
1 parent 4ddcdc1 commit 3f6d39e

File tree

4 files changed

+14
-14
lines changed

4 files changed

+14
-14
lines changed

src/scikit_build_core/program_search.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ def _get_cmake_path(*, module: bool = True) -> Generator[Path, None, None]:
3939
for candidate in candidates:
4040
cmake_path = shutil.which(candidate)
4141
if cmake_path is not None:
42-
yield Path(cmake_path).resolve()
42+
yield Path(cmake_path)
4343

4444

4545
def _get_ninja_path(*, module: bool = True) -> Generator[Path, None, None]:
@@ -58,7 +58,7 @@ def _get_ninja_path(*, module: bool = True) -> Generator[Path, None, None]:
5858
for candidate in candidates:
5959
ninja_path = shutil.which(candidate)
6060
if ninja_path is not None:
61-
yield Path(ninja_path).resolve()
61+
yield Path(ninja_path)
6262

6363

6464
def get_cmake_programs(*, module: bool = True) -> Generator[Program, None, None]:
@@ -116,7 +116,7 @@ def get_make_programs() -> Generator[Path, None, None]:
116116
for candidate in candidates:
117117
make_path = shutil.which(candidate)
118118
if make_path is not None:
119-
yield Path(make_path).resolve()
119+
yield Path(make_path)
120120

121121

122122
def best_program(

tests/test_cmake_config.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ def cmake_path() -> str:
2424
print(cmake_str)
2525
if cmake_str is None:
2626
pytest.skip("cmake must be installed for this test")
27-
return os.fspath(Path(cmake_str).resolve())
27+
return os.fspath(Path(cmake_str))
2828

2929
return os.fspath(Path(cmake.CMAKE_BIN_DIR) / "cmake")
3030

tests/test_get_requires.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ def which_mock(name: str) -> str | None:
2121
def test_get_requires_for_build_wheel(fp, monkeypatch):
2222
# This needs to be passed due to packaging.tags 22 extra checks if macos 10.16 is reported
2323
fp.pass_command([sys.executable, fp.any()])
24-
cmake = Path("cmake/path").resolve()
24+
cmake = Path("cmake/path")
2525
monkeypatch.setattr(shutil, "which", which_mock)
2626
monkeypatch.delenv("CMAKE_GENERATOR", raising=False)
2727
fp.register([os.fspath(cmake), "--version"], stdout="3.14.0")
@@ -30,7 +30,7 @@ def test_get_requires_for_build_wheel(fp, monkeypatch):
3030

3131
def test_get_requires_for_build_wheel_uneeded(fp, monkeypatch):
3232
fp.pass_command([sys.executable, fp.any()])
33-
cmake = Path("cmake/path").resolve()
33+
cmake = Path("cmake/path")
3434
monkeypatch.setattr(shutil, "which", which_mock)
3535
monkeypatch.delenv("CMAKE_GENERATOR", raising=False)
3636
fp.register([os.fspath(cmake), "--version"], stdout="3.18.0")
@@ -39,7 +39,7 @@ def test_get_requires_for_build_wheel_uneeded(fp, monkeypatch):
3939

4040
def test_get_requires_for_build_wheel_settings(fp, monkeypatch):
4141
fp.pass_command([sys.executable, fp.any()])
42-
cmake = Path("cmake/path").resolve()
42+
cmake = Path("cmake/path")
4343
monkeypatch.setattr(shutil, "which", which_mock)
4444
monkeypatch.delenv("CMAKE_GENERATOR", raising=False)
4545
fp.register([os.fspath(cmake), "--version"], stdout="3.18.0")
@@ -59,7 +59,7 @@ def test_get_requires_for_build_wheel_pyproject(fp, monkeypatch, tmp_path):
5959
minimum-version = "3.21"
6060
"""
6161
)
62-
cmake = Path("cmake/path").resolve()
62+
cmake = Path("cmake/path")
6363
monkeypatch.setattr(shutil, "which", which_mock)
6464
monkeypatch.delenv("CMAKE_GENERATOR", raising=False)
6565
fp.register([os.fspath(cmake), "--version"], stdout="3.18.0")

tests/test_program_search.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -39,8 +39,8 @@ def test_get_ninja_programs_cmake_module(monkeypatch):
3939

4040
def test_get_cmake_programs_all(monkeypatch, fp):
4141
monkeypatch.setattr("shutil.which", lambda x: x)
42-
cmake_path = Path("cmake").resolve()
43-
cmake3_path = Path("cmake3").resolve()
42+
cmake_path = Path("cmake")
43+
cmake3_path = Path("cmake3")
4444
fp.register(
4545
[os.fspath(cmake_path), "--version"],
4646
stdout="cmake version 3.20.0\n\nCMake suite maintained and supported by Kitware (kitware.com/cmake).",
@@ -67,8 +67,8 @@ def test_get_cmake_programs_all(monkeypatch, fp):
6767

6868
def test_get_ninja_programs_all(monkeypatch, fp):
6969
monkeypatch.setattr("shutil.which", lambda x: x if "ninja" in x else None)
70-
ninja_path = Path("ninja").resolve()
71-
ninja_build_path = Path("ninja-build").resolve()
70+
ninja_path = Path("ninja")
71+
ninja_build_path = Path("ninja-build")
7272
fp.register(
7373
[os.fspath(ninja_path), "--version"], stdout="1.10.1.git.kitware.jobserver-1"
7474
)
@@ -92,8 +92,8 @@ def test_get_ninja_programs_all(monkeypatch, fp):
9292
def test_get_cmake_programs_malformed(monkeypatch, fp, caplog):
9393
caplog.set_level(logging.WARNING)
9494
monkeypatch.setattr("shutil.which", lambda x: x)
95-
cmake_path = Path("cmake").resolve()
96-
cmake3_path = Path("cmake3").resolve()
95+
cmake_path = Path("cmake")
96+
cmake3_path = Path("cmake3")
9797
fp.register([os.fspath(cmake_path), "--version"], stdout="scrambled output\n")
9898
fp.register([os.fspath(cmake3_path), "--version"], stdout="cmake version 3.17.3\n")
9999
programs = list(get_cmake_programs(module=False))

0 commit comments

Comments
 (0)