summaryrefslogtreecommitdiff
path: root/engine/SCons/Subst.py
diff options
context:
space:
mode:
authorJörg Frings-Fürst <debian@jff-webhosting.net>2017-12-16 09:37:25 +0100
committerJörg Frings-Fürst <debian@jff-webhosting.net>2017-12-16 09:37:25 +0100
commit64bc937d72e11ca55df5475f88f5b4419bd0d287 (patch)
treedfb4c64908867f75bd2fff2c601b3354d2eb4d77 /engine/SCons/Subst.py
parent4d4007854125818bf3d71ef1a94c9fad3f6c8e0e (diff)
parent379b7995fe7e7ecd5583d73d8c4e352cd487578c (diff)
Merge branch 'release/3.0.1-1'3.0.1-1
Diffstat (limited to 'engine/SCons/Subst.py')
-rw-r--r--engine/SCons/Subst.py19
1 files changed, 16 insertions, 3 deletions
diff --git a/engine/SCons/Subst.py b/engine/SCons/Subst.py
index 90c12a0..9d0ec2a 100644
--- a/engine/SCons/Subst.py
+++ b/engine/SCons/Subst.py
@@ -26,7 +26,7 @@ SCons string substitution.
# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-__revision__ = "src/engine/SCons/Subst.py rel_3.0.0:4395:8972f6a2f699 2017/09/18 12:59:24 bdbaddog"
+__revision__ = "src/engine/SCons/Subst.py 74b2c53bc42290e911b334a6b44f187da698a668 2017/11/14 13:16:53 bdbaddog"
import collections
import re
@@ -338,7 +338,10 @@ SUBST_RAW = 1
SUBST_SIG = 2
_rm = re.compile(r'\$[()]')
-_rm_split = re.compile(r'(\$[()])')
+
+# Note the pattern below only matches $( or $) when there is no
+# preceeding $. (Thus the (?<!\$))
+_rm_split = re.compile(r'(?<!\$)(\$[()])')
# Indexed by the SUBST_* constants above.
_regex_remove = [ _rm, None, _rm_split ]
@@ -437,7 +440,11 @@ def scons_subst(strSubst, env, mode=SUBST_RAW, target=None, source=None, gvars={
if s0 != '$':
return s
if s1 == '$':
- return '$'
+ # In this case keep the double $'s which we'll later
+ # swap for a single dollar sign as we need to retain
+ # this information to properly avoid matching "$("" when
+ # the actual text was "$$("" (or "$)"" when "$$)"" )
+ return '$$'
elif s1 in '()':
return s
else:
@@ -583,6 +590,12 @@ def scons_subst(strSubst, env, mode=SUBST_RAW, target=None, source=None, gvars={
# Compress strings of white space characters into
# a single space.
result = _space_sep.sub(' ', result).strip()
+
+ # Now replace escaped $'s currently "$$"
+ # This is needed because we now retain $$ instead of
+ # replacing them during substition to avoid
+ # improperly trying to escape "$$(" as being "$("
+ result = result.replace('$$','$')
elif is_Sequence(result):
remove = _list_remove[mode]
if remove: