From ace1db739f6a2d2a86cef2d1d76d0ede7309593f Mon Sep 17 00:00:00 2001 From: Andrej730 Date: Wed, 22 Oct 2025 17:09:13 +0500 Subject: [PATCH] build-all - use `shutil.which` instead of custom function To make it more idiomatic and custom function also was misinterpreting folders with the same name as existing executables. --- nix/build-all.py | 11 +---------- 1 file changed, 1 insertion(+), 10 deletions(-) diff --git a/nix/build-all.py b/nix/build-all.py index 6a96a3ad74..9515b235a8 100644 --- a/nix/build-all.py +++ b/nix/build-all.py @@ -203,15 +203,6 @@ def cecho(message, color=NO_COLOR): logger.info(f"{color}{message}\033[0m") -def which(cmd: str) -> Union[str, None]: - PATH = os.getenv("PATH") - assert PATH - for path in PATH.split(":"): - if os.path.exists(path) and cmd in os.listdir(path): - return cmd - return None - - # Flags. APPLE = platform.system() == "Darwin" MAC_CROSS_COMPILE_INTEL = "mac-cross-compile-intel" in flags @@ -441,7 +432,7 @@ if "wasm" in flags: required_commands.remove(yacc) for cmd in required_commands: - if which(cmd) is None: + if shutil.which(cmd) is None: missing_commands.append(cmd) if missing_commands: