From 4c53f4359dd71b545f06cfda231587e93ed25643 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 44057c664c..a939373a75 100644 --- a/nix/build-all.py +++ b/nix/build-all.py @@ -201,15 +201,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 @@ -439,7 +430,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: