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.
This commit is contained in:
Andrej730
2025-10-22 17:09:13 +05:00
parent 80504310b6
commit ace1db739f
+1 -10
View File
@@ -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: