1. SCons
  2. Core
  3. SCons


SCons / src / engine / SCons / Action.xml


This file is processed by the bin/SConsDoc.py module.
See its __doc__ string for a discussion of the format.
Controls whether or not SCons will
add implicit dependencies for the commands
executed to build targets.

By default, SCons will add
to each target
an implicit dependency on the command
represented by the first argument on any
command line it executes.
The specific file for the dependency is
found by searching the
variable in the
environment used to execute the command.

If the construction variable
is set to a false value
then the implicit dependency will
not be added to the targets
built with that construction environment.


<cvar name="PRINT_CMD_LINE_FUNC">
A Python function used to print the command lines as they are executed
(assuming command printing is not disabled by the
options or their equivalents).
The function should take four arguments:
the command being executed (a string),
the target being built (file node, list, or string name(s)),
the source(s) used (file node, list, or string name(s)), and
the environment being used.

The function must do the printing itself.  The default implementation,
used if this variable is not set or is None, is:
def print_cmd_line(s, target, source, env):
  sys.stdout.write(s + "\n")

Here's an example of a more interesting function:

def print_cmd_line(s, target, source, env):
   sys.stdout.write("Building %s -> %s...\n" %
    (' and '.join([str(x) for x in source]),
     ' and '.join([str(x) for x in target])))
env.Program('foo', 'foo.c')

This just prints "Building <varname>targetname</varname> from <varname>sourcename</varname>..." instead
of the actual commands.
Such a function could also log the actual commands to a log file,
for example.

<cvar name="SPAWN">
A command interpreter function that will be called to execute command line
strings. The function must expect the following arguments:

def spawn(shell, escape, cmd, args, env):

is a string naming the shell program to use.
is a function that can be called to escape shell special characters in
the command line.
is the path to the command to be executed.
is the arguments to the command.
is a dictionary of the environment variables
in which the command should be executed.