diff options
author | Greg Noel <GregNoel@tigris.org> | 2010-04-21 15:13:26 (GMT) |
---|---|---|
committer | Greg Noel <GregNoel@tigris.org> | 2010-04-21 15:13:26 (GMT) |
commit | 57f9a905465a6022db0f0033c956afaecadc5d70 (patch) | |
tree | ed317ae6759a0bb9ba2e8a20a93a5f2b6981c876 /QMTest/TestCmd.py | |
parent | fcd10ca3c39538542594aec5f894fc00fa58bdb1 (diff) | |
download | SCons-57f9a905465a6022db0f0033c956afaecadc5d70.zip SCons-57f9a905465a6022db0f0033c956afaecadc5d70.tar.gz SCons-57f9a905465a6022db0f0033c956afaecadc5d70.tar.bz2 |
http://scons.tigris.org/issues/show_bug.cgi?id=2345
Pass the python executable from the -P option to runtest to TestCmd.py. Create the escaped executable name in TestCmd.py as well. Pass those two values into
derived test modules. Fix cascade problems in test scripts due to incorrect
assumptions about the name of the executable.
Diffstat (limited to 'QMTest/TestCmd.py')
-rw-r--r-- | QMTest/TestCmd.py | 56 |
1 files changed, 26 insertions, 30 deletions
diff --git a/QMTest/TestCmd.py b/QMTest/TestCmd.py index e715acc..0d07be6 100644 --- a/QMTest/TestCmd.py +++ b/QMTest/TestCmd.py @@ -253,7 +253,8 @@ __all__ = [ 'match_exact', 'match_re', 'match_re_dotall', - 'python_executable', + 'python', + '_python_', 'TestCmd' ] @@ -512,13 +513,31 @@ def diff_re(a, b, fromfile='', tofile='', i = i+1 return result -if os.name == 'java': - - python_executable = os.path.join(sys.prefix, 'jython') - +if os.name == 'posix': + def escape(arg): + "escape shell special characters" + slash = '\\' + special = '"$' + arg = arg.replace(slash, slash+slash) + for c in special: + arg = arg.replace(c, slash+c) + if re_space.search(arg): + arg = '"' + arg + '"' + return arg else: + # Windows does not allow special characters in file names + # anyway, so no need for an escape function, we will just quote + # the arg. + def escape(arg): + if re_space.search(arg): + arg = '"' + arg + '"' + return arg - python_executable = sys.executable +if os.name == 'java': + python = os.path.join(sys.prefix, 'jython') +else: + python = os.environ.get("python_executable", sys.executable) +_python_ = escape(python) if sys.platform == 'win32': @@ -913,30 +932,7 @@ class TestCmd(object): width = self.banner_width return s + self.banner_char * (width - len(s)) - if os.name == 'posix': - - def escape(self, arg): - "escape shell special characters" - slash = '\\' - special = '"$' - - arg = arg.replace(slash, slash+slash) - for c in special: - arg = arg.replace(c, slash+c) - - if re_space.search(arg): - arg = '"' + arg + '"' - return arg - - else: - - # Windows does not allow special characters in file names - # anyway, so no need for an escape function, we will just quote - # the arg. - def escape(self, arg): - if re_space.search(arg): - arg = '"' + arg + '"' - return arg + escape = staticmethod(escape) def canonicalize(self, path): if is_List(path): |