diff options
author | Steven Knight <knight@baldmt.com> | 2002-01-23 21:54:05 (GMT) |
---|---|---|
committer | Steven Knight <knight@baldmt.com> | 2002-01-23 21:54:05 (GMT) |
commit | cb0829ad927a55c4d79125e6ced5e975544a05a6 (patch) | |
tree | c29ac37bb286f200da768ac48fb0d5845ec510d6 /src/engine/SCons/Action.py | |
parent | 627e41f923a7db85b0d30ae1c6980c9fab2c642f (diff) | |
download | SCons-cb0829ad927a55c4d79125e6ced5e975544a05a6.zip SCons-cb0829ad927a55c4d79125e6ced5e975544a05a6.tar.gz SCons-cb0829ad927a55c4d79125e6ced5e975544a05a6.tar.bz2 |
Strip $(-$) bracketed text from command lines.
Diffstat (limited to 'src/engine/SCons/Action.py')
-rw-r--r-- | src/engine/SCons/Action.py | 26 |
1 files changed, 21 insertions, 5 deletions
diff --git a/src/engine/SCons/Action.py b/src/engine/SCons/Action.py index 38a4c70..26e81a5 100644 --- a/src/engine/SCons/Action.py +++ b/src/engine/SCons/Action.py @@ -31,6 +31,7 @@ __revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__" import os import os.path +import re import string import sys @@ -238,6 +239,9 @@ class ActionBase: return dict +_rm = re.compile(r'\$[()]') +_remove = re.compile(r'\$\(([^\$]|\$[^\(])*?\$\)') + class CommandAction(ActionBase): """Class for command-execution actions.""" def __init__(self, string): @@ -246,7 +250,7 @@ class CommandAction(ActionBase): def execute(self, **kw): import SCons.Util dict = apply(self.subst_dict, (), kw) - cmd_list = SCons.Util.scons_subst_list(self.command, dict, {}) + cmd_list = SCons.Util.scons_subst_list(self.command, dict, {}, _rm) for cmd_line in cmd_list: if len(cmd_line): if print_actions: @@ -262,8 +266,8 @@ class CommandAction(ActionBase): return ret return 0 - def get_contents(self, **kw): - """Return the signature contents of this action's command line. + def _sig_dict(self, kw): + """Supply a dictionary for use in computing signatures. For signature purposes, it doesn't matter what targets or sources we use, so long as we use the same ones every time @@ -272,8 +276,20 @@ class CommandAction(ActionBase): """ kw['target'] = ['__t1__', '__t2__'] kw['source'] = ['__s1__', '__s2__'] - dict = apply(self.subst_dict, (), kw) - return SCons.Util.scons_subst(self.command, dict, {}) + return apply(self.subst_dict, (), kw) + + def get_raw_contents(self, **kw): + """Return the complete contents of this action's command line. + """ + return SCons.Util.scons_subst(self.command, self._sig_dict(kw), {}) + + def get_contents(self, **kw): + """Return the signature contents of this action's command line. + + This strips $(-$) and everything in between the string, + since those parts don't affect signatures. + """ + return SCons.Util.scons_subst(self.command, self._sig_dict(kw), {}, _remove) class FunctionAction(ActionBase): """Class for Python function actions.""" |