Skip to content

Commit

Permalink
backend/ninja: use re.match instead of re.search
Browse files Browse the repository at this point in the history
Since we've already determined that the first character is the start of
the expression anyway.
  • Loading branch information
dcbaker committed Apr 23, 2024
1 parent 858e6ba commit 0cb6b52
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion mesonbuild/backend/ninjabackend.py
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,7 @@ def strToCommandArg(c: T.Union[NinjaCommandArg, str]) -> NinjaCommandArg:
# 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:
Expand Down

0 comments on commit 0cb6b52

Please sign in to comment.