summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorSteven Knight <knight@baldmt.com>2004-04-07 22:58:22 (GMT)
committerSteven Knight <knight@baldmt.com>2004-04-07 22:58:22 (GMT)
commitf8c2e8cf9666d85adbd85d0bc0dbebaca76fde08 (patch)
tree4848983354e94e8edb68331487af4eede8df5139 /src
parent18904c3a781f097ca6f8b3ad06ff6ce991ad2640 (diff)
downloadSCons-f8c2e8cf9666d85adbd85d0bc0dbebaca76fde08.zip
SCons-f8c2e8cf9666d85adbd85d0bc0dbebaca76fde08.tar.gz
SCons-f8c2e8cf9666d85adbd85d0bc0dbebaca76fde08.tar.bz2
Have Task.make_ready() create a list of the out-of-date Nodes.
Diffstat (limited to 'src')
-rw-r--r--src/CHANGES.txt3
-rw-r--r--src/engine/SCons/Taskmaster.py25
-rw-r--r--src/engine/SCons/TaskmasterTests.py44
3 files changed, 64 insertions, 8 deletions
diff --git a/src/CHANGES.txt b/src/CHANGES.txt
index 45295c6..a7323ea 100644
--- a/src/CHANGES.txt
+++ b/src/CHANGES.txt
@@ -64,6 +64,9 @@ RELEASE 0.96 - XXX
the env.SourceCode() method was called with an individual file name
or node, not a directory name or node.
+ - Enhance the Task.make_ready() method to create a list of the
+ out-of-date Nodes for the task for use by the wrapping interface.
+
From Gary Oberbrunner:
- Add a --debug=presub option to print actions prior to substitution.
diff --git a/src/engine/SCons/Taskmaster.py b/src/engine/SCons/Taskmaster.py
index 8afd847..ffdc065 100644
--- a/src/engine/SCons/Taskmaster.py
+++ b/src/engine/SCons/Taskmaster.py
@@ -169,17 +169,26 @@ class Task:
def make_ready(self):
"""Make a task ready for execution."""
- state = SCons.Node.up_to_date
+ self.out_of_date = []
calc = self.tm.calc
- for t in self.targets:
- c = calc or t.calculator()
- if not t.current(c):
- state = SCons.Node.executing
- for t in self.targets:
- if state == SCons.Node.executing:
+ if calc:
+ for t in self.targets:
+ if not t.current(calc):
+ self.out_of_date.append(t)
+ else:
+ for t in self.targets:
+ if not t.current(t.calculator()):
+ self.out_of_date.append(t)
+ if self.out_of_date:
+ state = SCons.Node.executing
+ for t in self.targets:
for side_effect in t.side_effects:
side_effect.set_state(state)
- t.set_state(state)
+ t.set_state(state)
+ else:
+ state = SCons.Node.up_to_date
+ for t in self.targets:
+ t.set_state(state)
def postprocess(self):
"""Post process a task after it's been executed."""
diff --git a/src/engine/SCons/TaskmasterTests.py b/src/engine/SCons/TaskmasterTests.py
index d20b805..1f66e06 100644
--- a/src/engine/SCons/TaskmasterTests.py
+++ b/src/engine/SCons/TaskmasterTests.py
@@ -23,6 +23,7 @@
__revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__"
+import copy
import sys
import unittest
@@ -409,6 +410,49 @@ class TaskmasterTestCase(unittest.TestCase):
t.executed()
+ def test_make_ready_out_of_date(self):
+ """Test the Task.make_ready() method's list of out-of-date Nodes
+ """
+ class MyCalc(SCons.Taskmaster.Calc):
+ def current(self, node, sig):
+ n = str(node)
+ return n[0] == 'c'
+
+ ood = []
+ def TaskGen(tm, targets, top, node, ood=ood):
+ class MyTask(SCons.Taskmaster.Task):
+ def make_ready(self):
+ SCons.Taskmaster.Task.make_ready(self)
+ self.ood.extend(self.out_of_date)
+ t = MyTask(tm, targets, top, node)
+ t.ood = ood
+ return t
+
+ n1 = Node("n1")
+ c2 = Node("c2")
+ n3 = Node("n3")
+ c4 = Node("c4")
+ tm = SCons.Taskmaster.Taskmaster(targets = [n1, c2, n3, c4],
+ tasker = TaskGen,
+ calc = MyCalc())
+
+ del ood[:]
+ t = tm.next_task()
+ assert ood == [n1], ood
+
+ del ood[:]
+ t = tm.next_task()
+ assert ood == [], ood
+
+ del ood[:]
+ t = tm.next_task()
+ assert ood == [n3], ood
+
+ del ood[:]
+ t = tm.next_task()
+ assert ood == [], ood
+
+
def test_make_ready_exception(self):
"""Test handling exceptions from Task.make_ready()
"""