From: stevenknight Date: Thu, 11 Apr 2002 19:13:45 +0000 (+0000) Subject: Make .sconsign files get written even if the build fails or is terminated. (Anthony... X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=3a284ab7e25966770c9e639519a3383e5897b6ce;p=scons.git Make .sconsign files get written even if the build fails or is terminated. (Anthony Roach) git-svn-id: http://scons.tigris.org/svn/scons/trunk@328 fdb21ef1-2011-0410-befe-b5e4ea1792b1 --- diff --git a/src/CHANGES.txt b/src/CHANGES.txt index f7de1c83..2207f3a2 100644 --- a/src/CHANGES.txt +++ b/src/CHANGES.txt @@ -46,6 +46,9 @@ RELEASE 0.07 - - Added $SOURCE variable as a synonym for $SOURCES[0]. + - Write out .sconsign files on error or interrupt so intermediate + build results are saved. + RELEASE 0.06 - Thu, 28 Mar 2002 01:24:29 -0600 diff --git a/src/engine/SCons/Node/__init__.py b/src/engine/SCons/Node/__init__.py index cbaed7b5..c8d5b2cc 100644 --- a/src/engine/SCons/Node/__init__.py +++ b/src/engine/SCons/Node/__init__.py @@ -114,6 +114,8 @@ class Node: def built(self): """Called just after this node is sucessfully built.""" + self.store_bsig() + # Clear out the implicit dependency caches: # XXX this really should somehow be made more general and put # under the control of the scanners. diff --git a/src/engine/SCons/Script/__init__.py b/src/engine/SCons/Script/__init__.py index 308552dd..813c3634 100644 --- a/src/engine/SCons/Script/__init__.py +++ b/src/engine/SCons/Script/__init__.py @@ -827,10 +827,12 @@ def _main(): taskmaster = SCons.Taskmaster.Taskmaster(nodes, task_class, calc) jobs = SCons.Job.Jobs(num_jobs, taskmaster) - jobs.start() - jobs.wait() - SCons.Sig.write() + try: + jobs.start() + jobs.wait() + finally: + SCons.Sig.write() def main(): try: diff --git a/src/engine/SCons/Taskmaster.py b/src/engine/SCons/Taskmaster.py index 7985b2e1..3fe96dae 100644 --- a/src/engine/SCons/Taskmaster.py +++ b/src/engine/SCons/Taskmaster.py @@ -90,7 +90,6 @@ class Task: if self.targets[0].get_state() == SCons.Node.executing: self.set_tstates(SCons.Node.executed) for t in self.targets: - t.store_bsig() t.built() self.tm.executed(self.node) diff --git a/test/errors.py b/test/errors.py index 1f582f78..9f1a83c9 100644 --- a/test/errors.py +++ b/test/errors.py @@ -26,9 +26,49 @@ __revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__" import TestCmd import TestSCons +import string test = TestSCons.TestSCons(match = TestCmd.match_re) +test.write('foo.in', 'foo') +test.write('exit.in', 'exit') +test.write('SConstruct', """ +import sys + +def foo(env, target, source): + print str(target[0]) + open(str(target[0]), 'wt').write('foo') + +def exit(env, target, source): + raise 'exit' + +env = Environment(BUILDERS = [Builder(name='foo', action=foo), + Builder(name='exit', action=exit)]) + +env.foo('foo.out', 'foo.in') +env.exit('exit.out', 'exit.in') +""") + +stderr = """scons: \*\*\* \[exit.out\] Exception +Traceback \((most recent call|innermost) last\): + File ".+", line \d+, in .+ + .+ + File ".+", line \d+, in .+ + .+ + File ".+", line \d+, in .+ + .+ + File ".+", line \d+, in .+ + .+ +.+ +""" + +test.run(arguments='foo.out exit.out', stderr=stderr, status=2) + +test.run(arguments='foo.out exit.out', stderr=stderr, status=2) +assert string.find(test.stdout(), 'scons: "foo.out" is up to date.') != -1, test.stdout() + + + test.write('SConstruct1', """ a ! x """)