summaryrefslogtreecommitdiff
path: root/bin/Command.py
diff options
context:
space:
mode:
authorSteven Knight <knight@baldmt.com>2009-02-19 05:58:40 +0000
committerSteven Knight <knight@baldmt.com>2009-02-19 05:58:40 +0000
commitd528748a0071ee74423a9a078d32f50395bbc2f8 (patch)
tree1d23d7c44adbd0e2664b36eded3ae93876ae8500 /bin/Command.py
parent28c1d1618395744154f264f222b1932ed6fa0fe7 (diff)
downloadscons-d528748a0071ee74423a9a078d32f50395bbc2f8.tar.gz
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.py14
1 files changed, 11 insertions, 3 deletions
diff --git a/bin/Command.py b/bin/Command.py
index b47e896a..efaa3569 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: