# SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
__author__ = "Steven Knight <knight at baldmt dot com>"
-__revision__ = "TestCmd.py 0.04.D009 2003/07/18 17:37:29 knight"
+__revision__ = "TestCmd.py 0.04.D010 2004/01/27 00:11:44 knight"
__version__ = "0.04"
import os
if interpreter:
cmd = interpreter + " " + cmd
else:
- cmd = self.program
+ cmd = escape_cmd(self.program)
if self.interpreter:
cmd = self.interpreter + " " + cmd
if arguments:
sys.stdout = Unbuffered(sys.stdout)
+_ws = re.compile('\s')
+
+def escape(s):
+ if _ws.search(s):
+ s = '"' + s + '"'
+ return s
+
for t in tests:
- cmd = string.join([python, debug, t.abspath], " ")
+ cmd = string.join(map(escape, [python, debug, t.abspath]), " ")
if printcmd:
sys.stdout.write(cmd + "\n")
s = os.system(cmd)
of whether the file was built via scons.bat or scons.py.
(Thanks to Niall Douglas for contributing code and testing.)
+ - Fix TestCmd.py, runtest.py and specific tests to accomodate being
+ run from directories whose paths include white space.
+
From Vincent Risi:
- Add support for the bcc32, ilink32 and tlib Borland tools.
stdout = "",
stderr = r"""
scons: \*\*\* No SConstruct file found.
-File "\S+", line \d+, in \S+
+File "[^"]+", line \d+, in \S+
""")
test.match_func = TestCmd.match_exact
stderr = None)
test.fail_test(not test.match_re(test.stderr(), """
scons: warning: Ignoring missing SConscript 'no_such_file'
-File "\S+", line \d+, in .*
+File "[^"]+", line \d+, in .*
"""))
test.pass_test()
#cmd_generated = "cd %s ; sh MAKE-HEADER.sh" % Dir(".")
#cmd_justlib = "cd %s ; make" % Dir(".")
-cmd_generated = "%s $SOURCE" % (sys.executable,)
-cmd_justlib = "%s %s -C ${SOURCES[0].dir}" % (sys.executable, sys.argv[0])
+_ws = re.compile('\s')
+
+def escape(s):
+ if _ws.search(s):
+ s = '"' + s + '"'
+ return s
+
+cmd_generated = "%s $SOURCE" % (escape(sys.executable),)
+cmd_justlib = "%s %s -C ${SOURCES[0].dir}" % ((sys.executable),
+ escape(sys.argv[0]))
##### Deps appear correct ... but wacky scanning?
# Why?