Download MAN page

Transcript
source
The list of source for a particular configured action.
The returned key should typically be a tuple of values derived from the arguments, using any appropriate logic to
decide how multiple invocations should be batched. For example, a batch_key function may decide to return the
value of a specific construction variable from the env argument which will cause scons to batch-build targets with
matching values of that variable, or perhaps return the id() of the entire construction environment, in which case
scons will batch-build all targets configured with the same construction environment. Returning None indicates
that the particular target should not be part of any batched build, but instead will be built by a separate invocation
of action's command or function. Example:
def batch_key(action, env, target, source):
tdir = target[0].dir
if tdir.name == 'special':
# Don't batch-build any target
# in the special/ subdirectory.
return None
return (id(action), id(env), tdir)
a = Action('build $CHANGED_SOURCES', batch_key=batch_key)
Miscellaneous Action Functions
scons supplies a number of functions that arrange for various common file and directory manipulations to be performed.
These are similar in concept to "tasks" in the Ant build tool, although the implementation is slightly different. These
functions do not actually perform the specified action at the time the function is called, but instead return an Action
object that can be executed at the appropriate time. (In Object-Oriented terminology, these are actually Action Factory
functions that return Action objects.)
In practice, there are two natural ways that these Action Functions are intended to be used.
First, if you need to perform the action at the time the SConscript file is being read, you can use the Execute global
function to do so:
Execute(Touch('file'))
Second, you can use these functions to supply Actions in a list for use by the Command method. This can allow you
to perform more complicated sequences of file manipulation without relying on platform-specific external commands:
that
env = Environment(TMPBUILD = '/tmp/builddir')
env.Command('foo.out', 'foo.in',
[Mkdir('$TMPBUILD'),
Copy('$TMPBUILD', '${SOURCE.dir}'),
"cd $TMPBUILD && make",
Delete('$TMPBUILD')])
Chmod(dest, mode)
Returns an Action object that changes the permissions on the specified dest file or directory to the specified mode.
Examples:
Execute(Chmod('file', 0755))
169