diff options
author | Gary Oberbrunner <garyo@oberbrunner.com> | 2012-12-20 23:59:23 -0500 |
---|---|---|
committer | Gary Oberbrunner <garyo@oberbrunner.com> | 2012-12-20 23:59:23 -0500 |
commit | f4edb08a4af66043bab63386d9c03b2be7c37875 (patch) | |
tree | e5f5d9f6ca6157f58e531d4894998d6c04c9853d | |
parent | b646c1c4a6d4825a03798ac610c3cb6d37bdbe02 (diff) | |
parent | feaeef3be77d66989f55c183618164b783b1ddee (diff) | |
download | scons-git-f4edb08a4af66043bab63386d9c03b2be7c37875.tar.gz |
Merged in techtonik/scons (pull request #63: Another minor cleanup as the code study goes on)
-rw-r--r-- | QMTest/TestCmd.py | 34 | ||||
-rw-r--r-- | SConstruct | 1 | ||||
-rw-r--r-- | bin/calibrate.py | 2 | ||||
-rw-r--r-- | bin/scons-test.py | 3 | ||||
-rw-r--r-- | src/CHANGES.txt | 2 | ||||
-rw-r--r-- | src/engine/SCons/cppTests.py | 3 | ||||
-rw-r--r-- | src/engine/SCons/exitfuncs.py | 19 | ||||
-rw-r--r-- | src/os_spawnv_fix.diff | 83 | ||||
-rw-r--r-- | src/test_strings.py | 2 | ||||
-rw-r--r-- | test/GetBuildFailures/parallel.py | 9 | ||||
-rw-r--r-- | test/GetBuildFailures/serial.py | 9 | ||||
-rw-r--r-- | test/runtest/noqmtest.py | 4 | ||||
-rw-r--r-- | test/runtest/xml/output.py | 2 |
13 files changed, 32 insertions, 141 deletions
diff --git a/QMTest/TestCmd.py b/QMTest/TestCmd.py index 0c42ab51e..911e361b3 100644 --- a/QMTest/TestCmd.py +++ b/QMTest/TestCmd.py @@ -363,18 +363,6 @@ else: re_space = re.compile('\s') -_Cleanup = [] - -def _clean(): - global _Cleanup - cleanlist = [ c for c in _Cleanup if c ] - del _Cleanup[:] - cleanlist.reverse() - for test in cleanlist: - test.cleanup() - -atexit.register(_clean) - def _caller(tblist, skip): string = "" arr = [] @@ -828,6 +816,17 @@ def send_all(p, data): raise Exception(disconnect_message) data = memoryview(data)[sent:] +_Cleanup = [] + +def _clean(): + global _Cleanup + cleanlist = [ c for c in _Cleanup if c ] + del _Cleanup[:] + cleanlist.reverse() + for test in cleanlist: + test.cleanup() + +atexit.register(_clean) class TestCmd(object): @@ -954,11 +953,9 @@ class TestCmd(object): shutil.rmtree(dir, ignore_errors = 1) self._dirlist = [] - try: global _Cleanup - _Cleanup.remove(self) - except (AttributeError, ValueError): - pass + if self in _Cleanup: + _Cleanup.remove(self) def command_args(self, program = None, interpreter = None, @@ -1513,10 +1510,9 @@ class TestCmd(object): # self._dirlist.append(path) + global _Cleanup - try: - _Cleanup.index(self) - except ValueError: + if self not in _Cleanup: _Cleanup.append(self) return path diff --git a/SConstruct b/SConstruct index 440799161..722429a48 100644 --- a/SConstruct +++ b/SConstruct @@ -662,7 +662,6 @@ scons = { 'LICENSE.txt', 'README.txt', 'RELEASE.txt', - 'os_spawnv_fix.diff', 'scons.1', 'sconsign.1', 'scons-time.1', diff --git a/bin/calibrate.py b/bin/calibrate.py index 72a6ac798..8ed2eceab 100644 --- a/bin/calibrate.py +++ b/bin/calibrate.py @@ -50,7 +50,7 @@ def main(argv=None): if len(args) > 1: print arg + ':' - command = [sys.executable, 'runtest.py', '--noqmtest'] + command = [sys.executable, 'runtest.py'] if opts.package: command.extend(['-p', opts.package]) command.append(arg) diff --git a/bin/scons-test.py b/bin/scons-test.py index 2191532c7..046cf4b0f 100644 --- a/bin/scons-test.py +++ b/bin/scons-test.py @@ -15,6 +15,7 @@ # so that problems on different platforms can be identified sooner. # +import atexit import getopt import imp import os @@ -74,7 +75,7 @@ if not os.path.exists(tempdir): import shutil os.chdir(startdir) shutil.rmtree(tempdir) - sys.exitfunc = cleanup + atexit.register(cleanup) # Fetch the input file if it happens to be across a network somewhere. # Ohmigod, does Python make this simple... diff --git a/src/CHANGES.txt b/src/CHANGES.txt index 21984e422..16cfa3ae6 100644 --- a/src/CHANGES.txt +++ b/src/CHANGES.txt @@ -18,6 +18,8 @@ RELEASE 2.X.X - * replaced `-o FILE --xml` combination with `--xml FILE` * changed `-o, --output FILE` option to capture stdout/stderr output from runtest.py + - Remove os_spawnv_fix.diff patch required to enable parallel builds + support prior to Python 2.2 From Juan Lang: - Fix WiX Tool to use .wixobj rather than .wxiobj for compiler output diff --git a/src/engine/SCons/cppTests.py b/src/engine/SCons/cppTests.py index bfb0b4614..2f2025be3 100644 --- a/src/engine/SCons/cppTests.py +++ b/src/engine/SCons/cppTests.py @@ -23,6 +23,7 @@ __revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__" +import atexit import sys import unittest @@ -608,7 +609,7 @@ def _clean(): if os.path.exists(dir): shutil.rmtree(dir) -sys.exitfunc = _clean +atexit.register(_clean) class fileTestCase(unittest.TestCase): cpp_class = cpp.DumbPreProcessor diff --git a/src/engine/SCons/exitfuncs.py b/src/engine/SCons/exitfuncs.py index 250dd5477..7d00df745 100644 --- a/src/engine/SCons/exitfuncs.py +++ b/src/engine/SCons/exitfuncs.py @@ -30,6 +30,7 @@ Register functions which are executed when SCons exits for any reason. __revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__" +import atexit _exithandlers = [] def _run_exitfuncs(): @@ -52,23 +53,9 @@ def register(func, *targs, **kargs): """ _exithandlers.append((func, targs, kargs)) -import sys -try: - x = sys.exitfunc - - # if x isn't our own exit func executive, assume it's another - # registered exit function - append it to our list... - if x != _run_exitfuncs: - register(x) - -except AttributeError: - pass - -# make our exit function get run by python when it exits: -sys.exitfunc = _run_exitfuncs - -del sys +# make our exit function get run by python when it exits +atexit.register(_run_exitfuncs) # Local Variables: # tab-width:4 diff --git a/src/os_spawnv_fix.diff b/src/os_spawnv_fix.diff deleted file mode 100644 index 926f896c1..000000000 --- a/src/os_spawnv_fix.diff +++ /dev/null @@ -1,83 +0,0 @@ -? dist/src/Mac/IDE scripts/Hold option to open a script
-? dist/src/Mac/IDE scripts/Insert file name
-? dist/src/Mac/IDE scripts/Insert folder name
-? dist/src/Mac/IDE scripts/Search Python Documentation
-? dist/src/Mac/IDE scripts/Hack/Remove .pyc files
-? dist/src/Mac/IDE scripts/Hack/Toolbox Assistant
-Index: dist/src/Modules/posixmodule.c
-===================================================================
-RCS file: /cvsroot/python/python/dist/src/Modules/posixmodule.c,v
-retrieving revision 2.213
-diff -c -c -r2.213 posixmodule.c
-*** dist/src/Modules/posixmodule.c 2001/12/03 20:41:00 2.213
---- dist/src/Modules/posixmodule.c 2001/12/05 00:52:58
-***************
-*** 1668,1674 ****
- #ifdef HAVE_SPAWNV
- static char posix_spawnv__doc__[] =
- "spawnv(mode, path, args)\n\
-! Execute an executable path with arguments, replacing current process.\n\
- \n\
- mode: mode of process creation\n\
- path: path of executable file\n\
---- 1668,1674 ----
- #ifdef HAVE_SPAWNV
- static char posix_spawnv__doc__[] =
- "spawnv(mode, path, args)\n\
-! Execute the program 'path' in a new process.\n\
- \n\
- mode: mode of process creation\n\
- path: path of executable file\n\
-***************
-*** 1717,1724 ****
-
- if (mode == _OLD_P_OVERLAY)
- mode = _P_OVERLAY;
- spawnval = _spawnv(mode, path, argvlist);
-!
- PyMem_DEL(argvlist);
-
- if (spawnval == -1)
---- 1717,1727 ----
-
- if (mode == _OLD_P_OVERLAY)
- mode = _P_OVERLAY;
-+
-+ Py_BEGIN_ALLOW_THREADS
- spawnval = _spawnv(mode, path, argvlist);
-! Py_END_ALLOW_THREADS
-!
- PyMem_DEL(argvlist);
-
- if (spawnval == -1)
-***************
-*** 1734,1740 ****
-
- static char posix_spawnve__doc__[] =
- "spawnve(mode, path, args, env)\n\
-! Execute a path with arguments and environment, replacing current process.\n\
- \n\
- mode: mode of process creation\n\
- path: path of executable file\n\
---- 1737,1743 ----
-
- static char posix_spawnve__doc__[] =
- "spawnve(mode, path, args, env)\n\
-! Execute the program 'path' in a new process.\n\
- \n\
- mode: mode of process creation\n\
- path: path of executable file\n\
-***************
-*** 1830,1836 ****
---- 1833,1843 ----
-
- if (mode == _OLD_P_OVERLAY)
- mode = _P_OVERLAY;
-+
-+ Py_BEGIN_ALLOW_THREADS
- spawnval = _spawnve(mode, path, argvlist, envlist);
-+ Py_END_ALLOW_THREADS
-+
- if (spawnval == -1)
- (void) posix_error();
- else
diff --git a/src/test_strings.py b/src/test_strings.py index a5ba227fc..3288d5f62 100644 --- a/src/test_strings.py +++ b/src/test_strings.py @@ -166,7 +166,6 @@ check_list = [ 'engine/SCons/Conftest.py', 'engine/SCons/dblite.py', 'MANIFEST', - 'os_spawnv_fix.diff', 'setup.cfg', ], # We run epydoc on the *.py files, which generates *.pyc files. @@ -214,7 +213,6 @@ check_list = [ 'QMTest/TestCmdTests.py', 'QMTest/TestCommon.py', 'QMTest/TestCommonTests.py', - 'src/os_spawnv_fix.diff', 'src/MANIFEST.in', 'src/setup.cfg', 'src/engine/MANIFEST.in', diff --git a/test/GetBuildFailures/parallel.py b/test/GetBuildFailures/parallel.py index e250486a3..b7576af6f 100644 --- a/test/GetBuildFailures/parallel.py +++ b/test/GetBuildFailures/parallel.py @@ -82,13 +82,8 @@ def print_build_failures(): for bf in sorted(GetBuildFailures(), key=lambda t: t.filename): print "%%s failed: %%s" %% (bf.node, bf.errstr) -try: - import atexit -except ImportError: - import sys - sys.exitfunc = print_build_failures -else: - atexit.register(print_build_failures) +import atexit +atexit.register(print_build_failures) """ % locals()) test.write('f3.in', "f3.in\n") diff --git a/test/GetBuildFailures/serial.py b/test/GetBuildFailures/serial.py index 752b3486b..9c56bb10d 100644 --- a/test/GetBuildFailures/serial.py +++ b/test/GetBuildFailures/serial.py @@ -95,13 +95,8 @@ def print_build_failures(): if bf.command: print "BF: %%s" %% " ".join(Flatten(bf.command)) -try: - import atexit -except ImportError: - import sys - sys.exitfunc = print_build_failures -else: - atexit.register(print_build_failures) +import atexit +atexit.register(print_build_failures) """ % locals()) test.write('f03.in', "f03.in\n") diff --git a/test/runtest/noqmtest.py b/test/runtest/noqmtest.py index eb332234a..cea2f116c 100644 --- a/test/runtest/noqmtest.py +++ b/test/runtest/noqmtest.py @@ -25,7 +25,7 @@ __revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__" """ -Test that the --noqmtest option invokes tests directly via Python, not +Test that by default tests are invoked directly via Python, not using qmtest. """ @@ -74,7 +74,7 @@ testlist = [ test_pass_py, ] -test.run(arguments = '-k --noqmtest %s' % ' '.join(testlist), +test.run(arguments = '-k %s' % ' '.join(testlist), status = 1, stdout = expect_stdout, stderr = expect_stderr) diff --git a/test/runtest/xml/output.py b/test/runtest/xml/output.py index 4702b7eb2..66d7911fd 100644 --- a/test/runtest/xml/output.py +++ b/test/runtest/xml/output.py @@ -52,7 +52,7 @@ test.write_no_result_test(['test', 'no_result.py']) test.write_passing_test(['test', 'pass.py']) -test.run(arguments = '-o xml.out --xml test', status=1) +test.run(arguments = '--xml xml.out test', status=1) expect = """\ <results> |