diff options
-rw-r--r-- | SConstruct | 14 | ||||
-rw-r--r-- | src/engine/SCons/Script/__init__.py | 7 | ||||
-rw-r--r-- | test/build-errors.py | 9 | ||||
-rw-r--r-- | test/builderrors.py | 6 | ||||
-rw-r--r-- | test/exceptions.py | 3 | ||||
-rw-r--r-- | test/option-i.py | 3 | ||||
-rw-r--r-- | test/option-k.py | 12 |
7 files changed, 31 insertions, 23 deletions
@@ -47,12 +47,13 @@ Default('.') def whereis(file): for dir in string.split(os.environ['PATH'], os.pathsep): f = os.path.join(dir, file) - try: - st = os.stat(f) - except: - continue - if stat.S_IMODE(st[stat.ST_MODE]) & 0111: - return f + if os.path.isfile(f): + try: + st = os.stat(f) + except: + continue + if stat.S_IMODE(st[stat.ST_MODE]) & 0111: + return f return None # @@ -356,7 +357,6 @@ for p in [ scons ]: # README.txt, or setup.py. Make a copy of the list for the # destination files. # - global src_files src_files = map(lambda x: x[:-1], open(os.path.join(src, 'MANIFEST.in')).readlines()) dst_files = map(lambda x: os.path.join(install, x), src_files) diff --git a/src/engine/SCons/Script/__init__.py b/src/engine/SCons/Script/__init__.py index 93ba795..2b907a0 100644 --- a/src/engine/SCons/Script/__init__.py +++ b/src/engine/SCons/Script/__init__.py @@ -90,13 +90,15 @@ class BuildTask(SCons.Taskmaster.Task): print SCons.Util.render_tree(self.targets[0], get_children) def failed(self): - global ignore_errors + global exit_status if ignore_errors: SCons.Taskmaster.Task.executed(self) elif keep_going_on_error: SCons.Taskmaster.Task.fail_continue(self) + exit_status = 2 else: SCons.Taskmaster.Task.fail_stop(self) + exit_status = 2 class CleanTask(SCons.Taskmaster.Task): """An SCons clean task.""" @@ -123,6 +125,7 @@ ignore_errors = 0 keep_going_on_error = 0 help_option = None print_tree = 0 +exit_status = 0 # exit status, assume success by default # utility functions @@ -710,4 +713,4 @@ def main(): except: _scons_other_errors() - + sys.exit(exit_status) diff --git a/test/build-errors.py b/test/build-errors.py index 694743a..ea129fa 100644 --- a/test/build-errors.py +++ b/test/build-errors.py @@ -48,7 +48,8 @@ env.bld(target = 'f1', source = 'f1.in') test.run(arguments='-f SConstruct1 .', stdout = "%s f1.in f1\n" % no_such_file, - stderr = None) + stderr = None, + status = 2) bad_command = "Bad command or file name\n" @@ -84,7 +85,8 @@ env.bld(target = 'f2', source = 'f2.in') test.run(arguments='-f SConstruct2 .', stdout = "%s f2.in f2\n" % not_executable, - stderr = None) + stderr = None, + status = 2) test.description_set("Incorrect STDERR:\n%s\n" % test.stderr()) if os.name == 'nt': @@ -107,7 +109,8 @@ env.bld(target = 'f3', source = 'f3.in') test.run(arguments='-f SConstruct3 .', stdout = "%s f3.in f3\n" % test.workdir, - stderr = None) + stderr = None, + status = 2) test.description_set("Incorrect STDERR:\n%s\n" % test.stderr()) if os.name == 'nt': diff --git a/test/builderrors.py b/test/builderrors.py index ff15610..8a574db 100644 --- a/test/builderrors.py +++ b/test/builderrors.py @@ -59,7 +59,7 @@ test.write(['one', 'f2.in'], "one/f2.in\n") test.write(['one', 'f3.in'], "one/f3.in\n") test.run(chdir = 'one', arguments = "f1.out f2.out f3.out", - stderr = "scons: *** [f1.out] Error 1\n") + stderr = "scons: *** [f1.out] Error 1\n", status = 2) test.fail_test(os.path.exists(test.workpath('f1.out'))) test.fail_test(os.path.exists(test.workpath('f2.out'))) @@ -79,7 +79,7 @@ test.write(['two', 'f2.in'], "two/f2.in\n") test.write(['two', 'f3.in'], "two/f3.in\n") test.run(chdir = 'two', arguments = "f1.out f2.out f3.out", - stderr = "scons: *** [f2.out] Error 1\n") + stderr = "scons: *** [f2.out] Error 1\n", status = 2) test.fail_test(test.read(['two', 'f1.out']) != "two/f1.in\n") test.fail_test(os.path.exists(test.workpath('f2.out'))) @@ -99,7 +99,7 @@ test.write(['three', 'f2.in'], "three/f2.in\n") test.write(['three', 'f3.in'], "three/f3.in\n") test.run(chdir = 'three', arguments = "f1.out f2.out f3.out", - stderr = "scons: *** [f3.out] Error 1\n") + stderr = "scons: *** [f3.out] Error 1\n", status = 2) test.fail_test(test.read(['three', 'f1.out']) != "three/f1.in\n") test.fail_test(test.read(['three', 'f2.out']) != "three/f2.in\n") diff --git a/test/exceptions.py b/test/exceptions.py index 2c6ad2d..acfe9dd 100644 --- a/test/exceptions.py +++ b/test/exceptions.py @@ -52,5 +52,6 @@ Traceback \((most recent call|innermost) last\): File "SConstruct", line 3, in func raise "func exception" func exception -""") +""", status = 2) + test.pass_test() diff --git a/test/option-i.py b/test/option-i.py index 6824006..c594563 100644 --- a/test/option-i.py +++ b/test/option-i.py @@ -59,7 +59,8 @@ test.write('aaa.in', "aaa.in\n") test.write('bbb.in', "bbb.in\n") test.run(arguments = 'aaa.1 aaa.out bbb.1 bbb.out', - stderr = 'scons: *** [aaa.1] Error 1\n') + stderr = 'scons: *** [aaa.1] Error 1\n', + status = 2) test.fail_test(os.path.exists(test.workpath('aaa.1'))) test.fail_test(os.path.exists(test.workpath('aaa.out'))) diff --git a/test/option-k.py b/test/option-k.py index 14a67b9..51fa6c6 100644 --- a/test/option-k.py +++ b/test/option-k.py @@ -58,16 +58,16 @@ test.write('aaa.in', "aaa.in\n") test.write('bbb.in', "bbb.in\n") test.run(arguments = 'aaa.out bbb.out', - stderr = - 'scons: *** [aaa.1] Error 1\n') + stderr = 'scons: *** [aaa.1] Error 1\n', + status = 2) test.fail_test(os.path.exists(test.workpath('aaa.1'))) test.fail_test(os.path.exists(test.workpath('aaa.out'))) test.fail_test(os.path.exists(test.workpath('bbb.out'))) test.run(arguments = '-k aaa.out bbb.out', - stderr = - 'scons: *** [aaa.1] Error 1\n') + stderr = 'scons: *** [aaa.1] Error 1\n', + status = 2) test.fail_test(os.path.exists(test.workpath('aaa.1'))) test.fail_test(os.path.exists(test.workpath('aaa.out'))) @@ -76,8 +76,8 @@ test.fail_test(test.read('bbb.out') != "succeed.py: bbb.out\n") test.unlink("bbb.out") test.run(arguments = '--keep-going aaa.out bbb.out', - stderr = - 'scons: *** [aaa.1] Error 1\n') + stderr = 'scons: *** [aaa.1] Error 1\n', + status = 2) test.fail_test(os.path.exists(test.workpath('aaa.1'))) test.fail_test(os.path.exists(test.workpath('aaa.out'))) |