Mako Template Builder for SCons
To install dependencies in a conda environment, execute the following commands.
conda env update --file etc/Requirements.yaml
To install dependencies into a virtualenv execute the following commands.
python -m pip install -r etc/requirements.txt
In the following example, the makotemplate
tool is found within the contrib
subdirectory.
import SCons
SCons.Tool.DefaultToolpath.insert(0, os.path.abspath('contrib'))
env = Environment(tools=['default', 'makotemplate'])
env.Mako('target.txt', 'source.txt.mako',
MAKO_DICTIONARY={'MakoContextVariables': 'Value'})
Which, when run, would render the template file source.txt.mako
Replace a ${MakoContextVariables}.
To the file source.txt
Replace a value.
Note
If your Mako template loads ohter files, make sure to explicitely define those dependencies in your SCons scripts.
mako = env.Mako('target.txt', 'source.txt.mako',
MAKO_DICTIONARY={'MakoContextVariables': 'Value'})
env.Depends(mako, [env.File('file_loaded_by_template.csv')])