Package psicons :: Package core :: Module commands
[hide private]
[frames] | no frames]

Module commands

source code

New scons commands.

The process of installing a new tool or module for use by SCons is fiddly, involves copying libraries in a tool directory, registering their use in build files, voids the ease of using easy_install and makes development a pain. Thus, these additional "commands" are real scons commands, so much as functions that generate commands. But they are easy to use.

Functions [hide private]
 
External(env, exe, args=[], infiles=[], output=[], depends=[], capture_stdout=None)
Create a task for doing analysis with an external (fixed) program.
source code
 
Script(env, path, interpreter=None, args=[], infiles=[], output=[], depends=[], capture_stdout=None)
Create a task for running a local script.
source code
Variables [hide private]
  __package__ = 'psicons.core'
Function Details [hide private]

External(env, exe, args=[], infiles=[], output=[], depends=[], capture_stdout=None)

source code 

Create a task for doing analysis with an external (fixed) program.

This is a command that runs an executable, intended for processing input datafiles to output data files. It calls the named executable with the passed arguments. Infiles and any others listed in depends are recorded as dependencies. outfiles and the captured output are listed as outputs. These will be used in dependency tracking.

Parameters:
  • env (Environment) - The environment created for the build
  • exe (str) - name of executable to be called
  • args (str or list) - either a string that is used to pass arguments to the executable (e.g. "--foo 5 -t one.txt") or a list of strings that can be joined to do the same (e.g. ["--foo", "5", "-t", "one.txt"]).
  • infiles (str or list) - a string or list of strings giving the paths of the files that this task depends on.
  • output (str or list) - a string or list of strings giving the paths of the files that this task produces.
  • capture_stdout (None or str) - Record the output of the tool. If a string is provided, this will be used as the path of the file to save it in.

Script(env, path, interpreter=None, args=[], infiles=[], output=[], depends=[], capture_stdout=None)

source code 

Create a task for running a local script.

This is a command that runs a local script, intended for processing input datafiles to output data files. It work like External, except that the script itself is made a dependency for this step. Thus ,alterations in the script will trigger rerunning. All undescribed parameters are as per External.

For example:

>>> env = SconsEnv()
>>> make_clean_data = Script ('Scripts/clean.py',
        ...     args = ['--save-as', 'output.txt'],
        ...     infiles = ['indata.txt'],
        ...     output = 'output.txt',
...     )
>>> type_data = Script ('count_types.pl',
...             interpreter = 'perl',
...             args = ['--use-types', 'type_data.csv'],
...             infiles = ['clean_data.txt'],
...             depends = 'type_config.txt',
...             capture_stdout='captured-types.txt',
...     )
Parameters:
  • path (str) - Pathway to the script
  • interpreter - Interpreter to run the script with. If None, assume it is python.