From 83923d1d530358d4859e60adfeb10afa6935b218 Mon Sep 17 00:00:00 2001 From: VAN BOSSUYT Nicolas Date: Fri, 21 Jul 2023 00:48:13 +0200 Subject: [PATCH] Don't include .exe when searching for latest version of a command on WSL. --- cutekit/builder.py | 2 +- cutekit/shell.py | 7 ++++++- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/cutekit/builder.py b/cutekit/builder.py index f505ec0..5fe9f6c 100644 --- a/cutekit/builder.py +++ b/cutekit/builder.py @@ -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 diff --git a/cutekit/shell.py b/cutekit/shell.py index aca09a4..7d0d8dd 100644 --- a/cutekit/shell.py +++ b/cutekit/shell.py @@ -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):