Don't include .exe when searching for latest version of a command on WSL.

This commit is contained in:
Sleepy Monax 2023-07-21 00:48:13 +02:00 committed by VAN BOSSUYT Nicolas
parent 865c18dfa3
commit 283556e998
2 changed files with 7 additions and 2 deletions

View file

@ -111,7 +111,7 @@ def build(componentSpec: str, targetSpec: str, props: Props = {}) -> ComponentIn
raise RuntimeError(
f"Component {componentSpec} is disabled: {instance.disableReason}")
shell.exec(f"ninja", "-v", "-f", ninjaPath, instance.outfile())
shell.exec(f"ninja", "-f", ninjaPath, instance.outfile())
return instance

View file

@ -234,7 +234,12 @@ def latest(cmd: str) -> str:
logger.info(f"Finding latest version of {cmd}")
regex = re.compile(r"^" + re.escape(cmd) + r"(-.[0-9]+)?(\.exe)?$")
regex: re.Pattern[str]
if platform.system() == "Windows":
regex = re.compile(r"^" + re.escape(cmd) + r"(-.[0-9]+)?(\.exe)?$")
else:
regex = re.compile(r"^" + re.escape(cmd) + r"(-[0-9]+)?$")
versions: list[str] = []
for path in os.environ["PATH"].split(os.pathsep):