diff options
author | Steven Knight <knight@baldmt.com> | 2009-02-19 05:58:40 (GMT) |
---|---|---|
committer | Steven Knight <knight@baldmt.com> | 2009-02-19 05:58:40 (GMT) |
commit | 29ad561d6bb373384273e24047efa79a88d406e7 (patch) | |
tree | 1d23d7c44adbd0e2664b36eded3ae93876ae8500 /bin/Command.py | |
parent | cfe6f670564137abdd937f994a4557f653e911b9 (diff) | |
download | SCons-29ad561d6bb373384273e24047efa79a88d406e7.zip SCons-29ad561d6bb373384273e24047efa79a88d406e7.tar.gz SCons-29ad561d6bb373384273e24047efa79a88d406e7.tar.bz2 |
dd newer SCons versions to the list of all versions available for install.
Use shlex.split(), not string.split(), to split command line arguments.
Commonize interpreation of 'cd' and 'mkdir' commands. Fix usage messages.
Diffstat (limited to 'bin/Command.py')
-rw-r--r-- | bin/Command.py | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/bin/Command.py b/bin/Command.py index b47e896..efaa356 100644 --- a/bin/Command.py +++ b/bin/Command.py @@ -7,6 +7,7 @@ import getopt import os +import shlex import sys class Usage(Exception): @@ -58,12 +59,19 @@ class CommandRunner: pass def do_execute(self, command): + if type(command) == type(''): + command = self.subst(command) + cmdargs = shlex.split(command) + if cmdargs[0] == 'cd': + command = (os.chdir,) + tuple(cmdargs[1:]) + elif cmdargs[0] == 'mkdir': + command = (os.mkdir,) + tuple(cmdargs[1:]) if type(command) == type(()): func = command[0] args = command[1:] return func(*args) else: - return os.system(self.subst(command)) + return os.system(command) def do_not_execute(self, command): pass @@ -94,8 +102,8 @@ def main(argv=None): Usage: script-template.py [-hnq] -h, --help Print this help and exit - -n, --no-exec No execute, just print the command line - -q, --quiet Quiet, don't print the command line + -n, --no-exec No execute, just print command lines + -q, --quiet Quiet, don't print command lines """ try: |