Skip to content

Commit e604f5d

Browse files
committed
Fix a NameError in sysconfig.expand_makefile_vars.
1 parent ae7f621 commit e604f5d

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

Lib/sysconfig/__init__.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -718,14 +718,17 @@ def expand_makefile_vars(s, vars):
718718
"""
719719
import re
720720

721+
find_var1_re = re.compile(r"\$\(([A-Za-z][A-Za-z0-9_]*)\)")
722+
find_var2_re = re.compile(r"\${([A-Za-z][A-Za-z0-9_]*)}")
723+
721724
# This algorithm does multiple expansion, so if vars['foo'] contains
722725
# "${bar}", it will expand ${foo} to ${bar}, and then expand
723726
# ${bar}... and so forth. This is fine as long as 'vars' comes from
724727
# 'parse_makefile()', which takes care of such expansions eagerly,
725728
# according to make's variable expansion semantics.
726729

727730
while True:
728-
m = re.search(_findvar1_rx, s) or re.search(_findvar2_rx, s)
731+
m = find_var1_re.search(s) or find_var2_re.search(s)
729732
if m:
730733
(beg, end) = m.span()
731734
s = s[0:beg] + vars.get(m.group(1)) + s[end:]

0 commit comments

Comments
 (0)