diff options
author | William Deegan <bill@baddogconsulting.com> | 2017-10-01 01:13:07 (GMT) |
---|---|---|
committer | William Deegan <bill@baddogconsulting.com> | 2017-10-01 01:13:07 (GMT) |
commit | f7a846e6c44b3ae20f8575c9823fc7cbe6d920d7 (patch) | |
tree | 4a8006806329a4ca1f1549c0c817f79b88e292ff /src/engine | |
parent | e1bc907a9213468a27b67a715b46524009daf6fb (diff) | |
download | SCons-f7a846e6c44b3ae20f8575c9823fc7cbe6d920d7.zip SCons-f7a846e6c44b3ae20f8575c9823fc7cbe6d920d7.tar.gz SCons-f7a846e6c44b3ae20f8575c9823fc7cbe6d920d7.tar.bz2 |
add fix for mistaking $$( for $( and breaking subst. Reported by Noah Hoffman noah.hoffman at gmail.com in: https://pairlist4.pair.net/pipermail/scons-users/2017-September/006352.html
Diffstat (limited to 'src/engine')
-rw-r--r-- | src/engine/SCons/Subst.py | 17 |
1 files changed, 15 insertions, 2 deletions
diff --git a/src/engine/SCons/Subst.py b/src/engine/SCons/Subst.py index a68b54d..68d247f 100644 --- a/src/engine/SCons/Subst.py +++ b/src/engine/SCons/Subst.py @@ -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: |