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.
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."""
__revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__"
+import copy
import sys
import unittest
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()
"""