SCons.Taskmaster.Taskmaster

Package SCons :: Module Taskmaster :: Class Taskmaster |
[hide private]
[frames] | no frames]

# Class Taskmaster

source code
The Taskmaster for walking the dependency DAG.

Instance Methods | [hide private]
__init__(self, targets=`[``]`, tasker=<class SCons.Taskmaster.Task at 0x1bab8f0>, order=False, trace=False) | source code
find_next_candidate(self) Returns the next candidate Node for (potential) evaluation. | source code
no_next_candidate(self) Stops Taskmaster processing by not returning a next candidate. | source code
_find_next_ready_node(self) Finds the next node that is ready to be built. | source code
next_task(self) Returns the next task to be executed. | source code
stop(self) Stops the current build completely. | source code

Method Details | [hide private]

### find_next_candidate(self) | source code
Returns the next candidate Node for (potential) evaluation. The candidate list (really a stack) initially consists of all of the top-level (command line) targets provided when the Taskmaster was initialized. While we walk the DAG, visiting Nodes, all the children that haven't finished processing get pushed on to the candidate list. Each child can then be popped and examined in turn for whether their children are all up-to-date, in which case a Task will be created for their actual evaluation and potential building. Here is where we also allow candidate Nodes to alter the list of Nodes that should be examined. This is used, for example, when invoking SCons in a source directory. A source directory Node can return its corresponding build directory Node, essentially saying, "Hey, you really need to build this thing over here instead."

### _find_next_ready_node(self) | source code
Finds the next node that is ready to be built. This is the main guts of the DAG walk. We loop through the list of candidates, looking for something that has no un-built children (i.e., that is a leaf Node or has dependencies that are all leaf Nodes or up-to-date). Candidate Nodes are re-scanned (both the target Node itself and its sources, which are always scanned in the context of a given target) to discover implicit dependencies. A Node that must wait for some children to be built will be put back on the candidates list after the children have finished building. A Node that has been put back on the candidates list in this way may have itself (or its sources) re-scanned, in order to handle generated header files (e.g.) and the implicit dependencies therein. Note that this method does not do any signature calculation or up-to-date check itself. All of that is handled by the Task class. This is purely concerned with the dependency graph walk.

### next_task(self) | source code
Returns the next task to be executed. This simply asks for the next Node to be evaluated, and then wraps it in the specific Task subclass with which we were initialized.