[issue24705] sysconfig._parse_makefile doesn't expand ${} vars appearing before $() vars

Matthias Klose report at bugs.python.org
Fri Jul 24 14:13:00 CEST 2015


New submission from Matthias Klose:

LIPL has the value

  ${prefix}/lib/python3.5/config-$(VERSION)$(ABIFLAGS)-x86_64-linux-gnu

and the code relies to substitute parameters from the left to the right, but it prefers $() variables. the attached patch substitutes all variables from the left to the right.

diff -r d8229c26dd92 Lib/sysconfig.py
--- a/Lib/sysconfig.py	Fri Jul 24 09:05:59 2015 +0300
+++ b/Lib/sysconfig.py	Fri Jul 24 14:04:57 2015 +0200
@@ -260,7 +260,12 @@
     while len(variables) > 0:
         for name in tuple(variables):
             value = notdone[name]
-            m = _findvar1_rx.search(value) or _findvar2_rx.search(value)
+            m1 = _findvar1_rx.search(value)
+            m2 = _findvar2_rx.search(value)
+            if m1 and m2:
+                m = m1 if m1.start() < m2.start() else m2
+	    else:
+                m = m1 if m1 else m2
             if m is not None:
                 n = m.group(1)
                 found = True

----------
assignee: doko
components: Library (Lib)
messages: 247272
nosy: doko
priority: normal
severity: normal
status: open
title: sysconfig._parse_makefile doesn't expand ${} vars appearing before $() vars
versions: Python 3.5, Python 3.6

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue24705>
_______________________________________


More information about the Python-bugs-list mailing list