From 78dd9bf1062237488280da54be0bd24378eb8ed2 Mon Sep 17 00:00:00 2001 From: Henry Schreiner Date: Wed, 25 Jan 2023 23:51:44 -0500 Subject: [PATCH] fix: handle local cmake dir for search Signed-off-by: Henry Schreiner --- src/scikit_build_core/program_search.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/scikit_build_core/program_search.py b/src/scikit_build_core/program_search.py index fbd5e95b1..4a2844d17 100644 --- a/src/scikit_build_core/program_search.py +++ b/src/scikit_build_core/program_search.py @@ -30,9 +30,10 @@ def _get_cmake_path(*, module: bool = True) -> Generator[Path, None, None]: """ if module: with contextlib.suppress(ImportError): - import cmake + # If a "cmake" directory exists, this will also ImportError + from cmake import CMAKE_BIN_DIR - yield Path(cmake.CMAKE_BIN_DIR) / "cmake" + yield Path(CMAKE_BIN_DIR) / "cmake" candidates = ("cmake3", "cmake") for candidate in candidates: @@ -48,9 +49,9 @@ def _get_ninja_path(*, module: bool = True) -> Generator[Path, None, None]: if module: with contextlib.suppress(ImportError): - import ninja + from ninja import BIN_DIR - yield Path(ninja.BIN_DIR) / "ninja" + yield Path(BIN_DIR) / "ninja" # Matches https://gitlab.kitware.com/cmake/cmake/-/blob/master/Modules/CMakeNinjaFindMake.cmake candidates = ("ninja-build", "ninja", "samu")