diff options
author | Steven Knight <knight@baldmt.com> | 2001-09-11 13:19:48 (GMT) |
---|---|---|
committer | Steven Knight <knight@baldmt.com> | 2001-09-11 13:19:48 (GMT) |
commit | d9fa9439a4424fce36654c68b39e6866cba502c9 (patch) | |
tree | 90cf1ba513b52811be3d541862817e96d091eaa3 /src | |
parent | 1be774d4845c05bacaecf93eec506ceb038ad8d8 (diff) | |
download | SCons-d9fa9439a4424fce36654c68b39e6866cba502c9.zip SCons-d9fa9439a4424fce36654c68b39e6866cba502c9.tar.gz SCons-d9fa9439a4424fce36654c68b39e6866cba502c9.tar.bz2 |
Add -n and -s support.
Diffstat (limited to 'src')
-rw-r--r-- | src/scons.py | 10 | ||||
-rw-r--r-- | src/scons/Builder.py | 15 |
2 files changed, 20 insertions, 5 deletions
diff --git a/src/scons.py b/src/scons.py index 66932f6..2649637 100644 --- a/src/scons.py +++ b/src/scons.py @@ -338,7 +338,10 @@ Option(func = opt_not_yet, future = 1, long = ['list-where'], help = "Don't build; list files and where defined.") -Option(func = opt_not_yet, +def opt_n(opt, arg): + scons.Builder.execute_actions = None + +Option(func = opt_n, short = 'n', long = ['no-exec', 'just-print', 'dry-run', 'recon'], help = "Don't build; just print commands.") @@ -366,7 +369,10 @@ Option(func = opt_not_yet, future = 1, long = ['random'], help = "Build dependencies in random order.") -Option(func = opt_not_yet, +def opt_s(opt, arg): + scons.Builder.print_actions = None + +Option(func = opt_s, short = 's', long = ['silent', 'quiet'], help = "Don't print commands.") diff --git a/src/scons/Builder.py b/src/scons/Builder.py index c11c9f3..8b19bd5 100644 --- a/src/scons/Builder.py +++ b/src/scons/Builder.py @@ -51,6 +51,11 @@ class Builder: +print_actions = 1; +execute_actions = 1; + + + def Action(act): """A factory for action objects.""" if type(act) == types.FunctionType: @@ -78,8 +83,10 @@ class CommandAction(ActionBase): def execute(self, **kw): cmd = self.command % kw - self.show(cmd) - os.system(cmd) + if print_actions: + self.show(cmd) + if execute_actions: + os.system(cmd) class FunctionAction(ActionBase): """Class for Python function actions.""" @@ -87,5 +94,7 @@ class FunctionAction(ActionBase): self.function = function def execute(self, **kw): + # if print_actions: # XXX: WHAT SHOULD WE PRINT HERE? - self.function(kw) + if execute_actions: + self.function(kw) |