This commit is contained in:
김경종
2026-06-10 10:03:11 +09:00
parent 87529c811a
commit 0912ee6f3b
174 changed files with 414 additions and 8544 deletions
+3 -31
View File
@@ -88,27 +88,7 @@ def discover_commands(root: Path) -> list[str]:
return load_cmake_commands(root)
def resolve_validation_command(command: str) -> str:
parts = command.split(maxsplit=1)
if not parts:
return command
tool = parts[0].lower()
if tool not in {"cmake", "ctest"}:
return command
if shutil.which(tool) is not None:
return command
exe = COMMON_CMAKE_BIN / f"{tool}.exe"
if not exe.exists():
return command
suffix = f" {parts[1]}" if len(parts) > 1 else ""
return f'"{exe}"{suffix}'
def run_command(command: str, root: Path) -> subprocess.CompletedProcess:
command = resolve_validation_command(command)
return subprocess.run(
command,
cwd=root,
@@ -123,25 +103,17 @@ def run_command(command: str, root: Path) -> subprocess.CompletedProcess:
def validation_environment(base_env: os._Environ | dict[str, str]) -> dict[str, str]:
env = dict(base_env)
path_key = "Path" if os.name == "nt" else "PATH"
path_values = []
for key in list(env):
if key.lower() == "path":
path_values.append(env.pop(key))
current_path = os.pathsep.join(part for part in path_values if part)
env[path_key] = current_path
if shutil.which("cmake", path=current_path) is not None:
if shutil.which("cmake") is not None:
return env
cmake_exe = COMMON_CMAKE_BIN / "cmake.exe"
if not cmake_exe.exists():
return env
current_path = env.get("PATH", "")
paths = [part for part in current_path.split(os.pathsep) if part]
common_bin_text = str(COMMON_CMAKE_BIN)
if not any(part.lower() == common_bin_text.lower() for part in paths):
env[path_key] = common_bin_text + (os.pathsep + current_path if current_path else "")
env["PATH"] = common_bin_text + (os.pathsep + current_path if current_path else "")
return env