Build: Unify windows and linux find executable code

This commit is contained in:
xavisolesoft 2024-01-24 11:14:29 +01:00
parent 6d5f8f5b2b
commit 0f68481a09
1 changed files with 5 additions and 17 deletions

View File

@ -49,23 +49,11 @@ DEFAULT_ERROR_MESSAGE = (
def FindExecutable(candidates : list):
if os.name == 'nt':
# TODO: test if find_executable(e) works properly for windows and unify windows and linux code if works
for e in candidates:
ec = subprocess.call(
[ 'where' if os.name == 'nt' else 'whereis', e ],
stdout = subprocess.PIPE,
stderr = subprocess.PIPE,
shell = True)
if ec == 0:
return e
return None
else:
for e in candidates:
find_executable(e)
if e:
return e
return None
for e in candidates:
executable_path = find_executable(e)
if executable_path:
return e
return None
DEFAULT_C_COMPILER = FindExecutable([
'cl',