summaryrefslogtreecommitdiff
path: root/engine/SCons/Subst.py
diff options
context:
space:
mode:
authorJörg Frings-Fürst <debian@jff-webhosting.net>2017-12-14 14:37:42 +0100
committerJörg Frings-Fürst <debian@jff-webhosting.net>2017-12-14 14:37:42 +0100
commitcd2ab5002aa2359575088bbc3183a9a91cc50c31 (patch)
tree810f2b7be99b16aee13a80daf4ca71597b42ecd6 /engine/SCons/Subst.py
parent7c651e273c4db37f4babd91aaecf26800c50dd79 (diff)
New upstream version 3.0.1upstream/3.0.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: