diff options
| author | Steven Knight <knight@baldmt.com> | 2004-12-03 16:06:04 (GMT) |
|---|---|---|
| committer | Steven Knight <knight@baldmt.com> | 2004-12-03 16:06:04 (GMT) |
| commit | f0c3476fdae7032e6232d112864518934ba8a13e (patch) | |
| tree | fe59fb9ac580b7b454482d93d0389cd0f00f12fc /src | |
| parent | 9bb2d035b8c5b5f1575ba40eb264d7a334f10542 (diff) | |
| download | SCons-f0c3476fdae7032e6232d112864518934ba8a13e.zip SCons-f0c3476fdae7032e6232d112864518934ba8a13e.tar.gz SCons-f0c3476fdae7032e6232d112864518934ba8a13e.tar.bz2 | |
Print --debug={tree,dtree,includes} even if the build has an error.
Diffstat (limited to 'src')
| -rw-r--r-- | src/CHANGES.txt | 3 | ||||
| -rw-r--r-- | src/engine/SCons/Script/__init__.py | 38 | ||||
| -rw-r--r-- | src/engine/SCons/Taskmaster.py | 16 | ||||
| -rw-r--r-- | src/engine/SCons/TaskmasterTests.py | 14 |
4 files changed, 52 insertions, 19 deletions
diff --git a/src/CHANGES.txt b/src/CHANGES.txt index ebfc13c..021d1d4 100644 --- a/src/CHANGES.txt +++ b/src/CHANGES.txt @@ -147,6 +147,9 @@ RELEASE 0.97 - XXX - Add specific exceptions to try:-except: blocks without any listed, so that they won't catch and mask keyboard interrupts. + - Make --debug={tree,dtree,stree} print something even when there's + a build failure. + From Wayne Lee: - Avoid "maximum recursion limit" errors when removing $(-$) pairs diff --git a/src/engine/SCons/Script/__init__.py b/src/engine/SCons/Script/__init__.py index 7d139a1..71c2f03 100644 --- a/src/engine/SCons/Script/__init__.py +++ b/src/engine/SCons/Script/__init__.py @@ -121,25 +121,6 @@ class BuildTask(SCons.Taskmaster.Task): else: SCons.Taskmaster.Task.executed(self) - # print the tree here instead of in execute() because - # this method is serialized, but execute isn't: - if print_tree and self.top: - print - SCons.Util.print_tree(self.targets[0], get_all_children) - if print_stree and self.top: - print - SCons.Util.print_tree(self.targets[0], get_all_children, - showtags=2) - if print_dtree and self.top: - print - SCons.Util.print_tree(self.targets[0], get_derived_children) - if print_includes and self.top: - t = self.targets[0] - tree = t.render_include_tree() - if tree: - print - print tree - def failed(self): # Handle the failure of a build task. The primary purpose here # is to display the various types of Errors and Exceptions @@ -182,6 +163,25 @@ class BuildTask(SCons.Taskmaster.Task): self.exc_clear() + def postprocess(self): + if self.top: + t = self.targets[0] + if print_tree: + print + SCons.Util.print_tree(t, get_all_children) + if print_stree: + print + SCons.Util.print_tree(t, get_all_children, showtags=2) + if print_dtree: + print + SCons.Util.print_tree(t, get_derived_children) + if print_includes: + tree = t.render_include_tree() + if tree: + print + print tree + SCons.Taskmaster.Task.postprocess(self) + def make_ready(self): """Make a task ready for execution""" SCons.Taskmaster.Task.make_ready(self) diff --git a/src/engine/SCons/Taskmaster.py b/src/engine/SCons/Taskmaster.py index 6bd5e21..b528f44 100644 --- a/src/engine/SCons/Taskmaster.py +++ b/src/engine/SCons/Taskmaster.py @@ -152,8 +152,16 @@ class Task: for t in self.targets: t.set_state(SCons.Node.failed) self.tm.failed(self.node) + next_top = self.tm.next_top_level_candidate() self.tm.stop() + if next_top: + # We're stopping because of a build failure, but give the + # calling Task class a chance to postprocess() the top-level + # target under which the build failure occurred. + self.targets = [next_top] + self.top = 1 + def fail_continue(self): """Explicit continue-the-build failure. @@ -426,6 +434,14 @@ class Taskmaster: return not self.ready and (self.pending or self.executing) + def next_top_level_candidate(self): + candidates = self.candidates[:] + candidates.reverse() + for c in candidates: + if c in self.targets: + return c + return None + def stop(self): """Stop the current build completely.""" self.candidates = [] diff --git a/src/engine/SCons/TaskmasterTests.py b/src/engine/SCons/TaskmasterTests.py index cc4ba0c..a3e4219 100644 --- a/src/engine/SCons/TaskmasterTests.py +++ b/src/engine/SCons/TaskmasterTests.py @@ -625,6 +625,20 @@ class TaskmasterTestCase(unittest.TestCase): tm = MyTM() assert tm.is_blocked() + def test_next_top_level_candidate(self): + """Test the next_top_level_candidate() method + """ + n1 = Node("n1") + n2 = Node("n2", [n1]) + n3 = Node("n3", [n2]) + + tm = SCons.Taskmaster.Taskmaster([n3]) + t = tm.next_task() + assert tm.executing == [n1], tm.executing + t.fail_stop() + assert t.targets == [n3], t.targets + assert t.top == 1, t.top + def test_stop(self): """Test the stop() method |
