From 27dc1bcacb24b190a9afd767fa49a1161202fc6b Mon Sep 17 00:00:00 2001 From: Dylan Baker Date: Tue, 23 Apr 2024 09:35:37 -0700 Subject: [PATCH] backend/ninja: use re.match instead of re.search Since we've already determined that the first character is the start of the expression anyway. --- mesonbuild/backend/ninjabackend.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mesonbuild/backend/ninjabackend.py b/mesonbuild/backend/ninjabackend.py index 228312d55..2b4a0cf97 100644 --- a/mesonbuild/backend/ninjabackend.py +++ b/mesonbuild/backend/ninjabackend.py @@ -199,7 +199,7 @@ class NinjaRule: # shell constructs shouldn't be shell quoted return NinjaCommandArg(c, Quoting.notShell) if c.startswith('$'): - varp = re.search(r'\$\{?(\w*)\}?', c) + varp = re.match(r'\$\{?(\w*)\}?', c) assert varp is not None, 'for mypy' var: str = varp.group(1) if var not in raw_names: