PyScons

An extension to Scons which enables dependency tracking on Python script imports
Download

PyScons Ranking & Summary

Advertisement

  • Rating:
  • License:
  • MIT/X Consortium Lic...
  • Publisher Name:
  • S. Joshua Swamidass

PyScons Tags


PyScons Description

An extension to Scons which enables dependency tracking on Python script imports PyScons is a Python module which works with Scons. It is installed into a new environment with either of the two commands:from pyscons import PYTOOLenv = Environment(tools = )or:from pyscons import PYTOOLenv = Environment()PYTOOL()(env)This does two things: 1. Installs a new builder: PyScript. 2. Installs a new scanner for python scripts.PyScriptThis Builder has a few additional abilities.First, it will automatically find the ".py" files referred to when running a module as a script with the '-m' option. For example the following code will run a module as script and add the appriate files to the dependencies:env.PyScript("out", , "python $SOURCES > $TARGET")Second, it defaults the command string to "python $SOURCES" and using the "capture" keyword argument, can automatically append the appropriate strings to capture the output or error (or both) to the targets:env.PyScript("out", , capture="output")or to capture both the output and error:env.PyScript(, , capture="both")Just like Command, multiple steps can be used to create a file:env.PyScript("out", , } > temp", "python ${SOURCES} > $TARGET", Delete("temp")])PyScannerThis scanner uses the modulefinder module to find all import dependencies in all sources with a 'py' extension. It can take two options in its constructor: 1. filter_path: a callable object (or None) which takes a path as input and returns true if this file should be included as a dependency by scons, or false if it should be ignored. By default, this variable becomes a function which ensures that no system python modules or modules from site-packages are tracked. To track all files, use "lambda p: True". 2. recursive: with a true (default) or false, it enables or disables recursive dependency tracking.For example to track all files (including system imports) in a nonrecursive scanner, use the following install code in your SConstruct:from pyscons import PYTOOLenv = Environment(tools = ) Requirements: · Python


PyScons Related Software