Package SCons :: Module Action
[hide private]
[frames] | no frames]

Module Action

source code


This encapsulates information about executing any sort of action that
can build one or more target Nodes (typically files) from one or more
source Nodes (also typically files) given a specific Environment.

The base class here is ActionBase.  The base class supplies just a few
OO utility methods and some generic methods for displaying information
about an Action in response to the various commands that control printing.

A second-level base class is _ActionAction.  This extends ActionBase
by providing the methods that can be used to show and perform an
action.  True Action objects will subclass _ActionAction; Action
factory class objects will subclass ActionBase.

The heavy lifting is handled by subclasses for the different types of
actions we might execute:


The subclasses supply the following public interface methods used by
other modules:

        THE public interface, "calling" an Action object executes the
        command or Python function.  This also takes care of printing
        a pre-substitution command for debugging purposes.

        Fetches the "contents" of an Action for signature calculation
        plus the varlist.  This is what gets MD5 checksummed to decide
        if a target needs to be rebuilt because its action changed.

        Returns a string representation of the Action *without*
        command substitution, but allows a CommandGeneratorAction to
        generate the right action based on the specified target,
        source and env.  This is used by the Signature subsystem
        (through the Executor) to obtain an (imprecise) representation
        of the Action operation for informative purposes.

Subclasses also supply the following methods for internal use within
this module:

        Returns a string approximation of the Action; no variable
        substitution is performed.

        The internal method that really, truly, actually handles the
        execution of a command or Python function.  This is used so
        that the __call__() methods can take care of displaying any
        pre-substitution representations, and *then* execute an action
        without worrying about the specific Actions involved.

        Fetches the "contents" of a subclass for signature calculation.
        The varlist is added to this to produce the Action's contents.

        Returns a substituted string representation of the Action.
        This is used by the command to display the
        command/function that will be executed to generate the target(s).

There is a related independent ActionCaller class that looks like a
regular Action, and which serves as a wrapper for arbitrary functions
that we want to let the user specify the arguments to now, but actually
execute later (when an out-of-date check determines that it's needed to
be executed, for example).  Objects of this class are returned by an
ActionFactory class that provides a __call__() method as a convenient
way for wrapping up the functions.

Classes [hide private]
Base class for all types of action objects that can be held by other objects (Builders, Executors, etc.) This provides the common methods for manipulating and combining those actions.
Base class for actions that create output objects.
Class for command-execution actions.
Class for command-generator actions.
Class for Python function actions.
Class for lists of other actions.
A class for delaying calling an Action function with specific (positional and keyword) arguments until the Action is actually executed.
A factory class that will wrap up an arbitrary function as an SCons-executable Action object.
Functions [hide private]
rfile(n) source code
default_exitstatfunc(s) source code
remove_set_lineno_codes(x) source code
Return the signature contents of a callable Python object.
source code
Return the signature contents of any Python object.
source code
Return the signature contents of a code object.
source code
Return the signature contents of a function.
source code
_actionAppend(act1, act2) source code
_do_create_keywords(args, kw)
This converts any arguments after the action argument into their equivalent keywords and adds them to the kw argument.
source code
_do_create_action(act, kw)
This is the actual "implementation" for the Action factory method, below.
source code
_do_create_list_action(act, kw)
A factory for list actions.
source code
Action(act, *args, **kw)
A factory for action objects.
source code
Takes a list of command line arguments and returns a pretty representation for printing.
source code
get_default_ENV(env) source code
_subproc(env, cmd, error='ignore', **kw)
Do common setup for a subprocess.Popen() call
source code
Variables [hide private]
  __revision__ = 'src/engine/SCons/ 3842 2008/12/20 22:...
  print_actions = False
  execute_actions = False
  print_actions_presub = 0
  default_ENV = False
Function Details [hide private]


source code 
Return the signature contents of any Python object.

We have to handle the case where object contains a code object
since it can be pickled directly.


source code 
Return the signature contents of a code object.

By providing direct access to the code object of the
function, Python makes this extremely easy.  Hooray!

Unfortunately, older versions of Python include line
number indications in the compiled byte code.  Boo!
So we remove the line number byte codes to prevent
recompilations from moving a Python function.

_do_create_action(act, kw)

source code 
This is the actual "implementation" for the
Action factory method, below.  This handles the
fact that passing lists to Action() itself has
different semantics than passing lists as elements
of lists.

The former will create a ListAction, the latter
will create a CommandAction by converting the inner
list elements to strings.

_do_create_list_action(act, kw)

source code 
A factory for list actions.  Convert the input list into Actions
and then wrap them in a ListAction.

Variables Details [hide private]


'src/engine/SCons/ 3842 2008/12/20 22:59:52 scons'