summaryrefslogtreecommitdiffstats
path: root/src/engine/SCons/Util.py
diff options
context:
space:
mode:
authorSteven Knight <knight@baldmt.com>2002-01-23 21:54:05 (GMT)
committerSteven Knight <knight@baldmt.com>2002-01-23 21:54:05 (GMT)
commitcb0829ad927a55c4d79125e6ced5e975544a05a6 (patch)
treec29ac37bb286f200da768ac48fb0d5845ec510d6 /src/engine/SCons/Util.py
parent627e41f923a7db85b0d30ae1c6980c9fab2c642f (diff)
downloadSCons-cb0829ad927a55c4d79125e6ced5e975544a05a6.zip
SCons-cb0829ad927a55c4d79125e6ced5e975544a05a6.tar.gz
SCons-cb0829ad927a55c4d79125e6ced5e975544a05a6.tar.bz2
Strip $(-$) bracketed text from command lines.
Diffstat (limited to 'src/engine/SCons/Util.py')
-rw-r--r--src/engine/SCons/Util.py13
1 files changed, 10 insertions, 3 deletions
diff --git a/src/engine/SCons/Util.py b/src/engine/SCons/Util.py
index a207ffc..16d2c76 100644
--- a/src/engine/SCons/Util.py
+++ b/src/engine/SCons/Util.py
@@ -170,7 +170,7 @@ class PathList(UserList.UserList):
_cv = re.compile(r'\$([_a-zA-Z]\w*|{[^}]*})')
_space_sep = re.compile(r'[\t ]+(?![^{]*})')
-def scons_subst_list(strSubst, locals, globals):
+def scons_subst_list(strSubst, locals, globals, remove=None):
"""
This function is similar to scons_subst(), but with
one important difference. Instead of returning a single
@@ -214,10 +214,12 @@ def scons_subst_list(strSubst, locals, globals):
strSubst, n = _cv.subn(repl, strSubst)
# Now parse the whole list into tokens.
listLines = string.split(strSubst, '\n')
+ if remove:
+ listLines = map(lambda x,re=remove: re.sub('', x), listLines)
return map(lambda x: filter(lambda y: y, string.split(x, '\0')),
listLines)
-def scons_subst(strSubst, locals, globals):
+def scons_subst(strSubst, locals, globals, remove=None):
"""Recursively interpolates dictionary variables into
the specified string, returning the expanded result.
Variables are specified by a $ prefix in the string and
@@ -227,7 +229,7 @@ def scons_subst(strSubst, locals, globals):
surrounded by curly braces to separate the name from
trailing characters.
"""
- cmd_list = scons_subst_list(strSubst, locals, globals)
+ cmd_list = scons_subst_list(strSubst, locals, globals, remove)
return string.join(map(string.join, cmd_list), '\n')
def find_files(filenames, paths,
@@ -351,6 +353,11 @@ class DirVarInterp(VarInterpolator):
self.dictInstCache[(dir, fs)] = ret
return ret
+ def generate(self, dict):
+ VarInterpolator.generate(self, dict)
+ if dict[self.dest]:
+ dict[self.dest] = ['$('] + dict[self.dest] + ['$)']
+
AUTO_GEN_VARS = ( VarInterpolator('_LIBFLAGS',
'LIBS',
'LIBLINKPREFIX',