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
#
# 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)
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."""
keep_going_on_error = 0
help_option = None
print_tree = 0
+exit_status = 0 # exit status, assume success by default
# utility functions
except:
_scons_other_errors()
-
+ sys.exit(exit_status)
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"
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':
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':
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')))
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')))
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")
File "SConstruct", line 3, in func
raise "func exception"
func exception
-""")
+""", status = 2)
+
test.pass_test()
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')))
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')))
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')))