zc.buildout recipes for generating script and conf files from templates.
buildout_script is a zc.buildout recipe for generating scripts from a template. Unlike scripts specified in by the console_scripts entry point, those generated by buildout_script are not restricted to Python code.
Scripts are generated from templates and can include settings from the buildout substituted at runtime.
One example usage is the generation of a wrapper script for Paste Script to check the status of a daemonized server process (see paster-check below).
To use the buildout_script recipe, specify it as the recipe for a zc.buildout part along with the template part. For example:
[sample_part] recipe = buildout_script template = paster-check.sh.in
The script will be created in the bin-directory. You may also specify the following parameters:
- The filename for the generated script; if omitted, the script will have the template filename without the extension.
- An optional directory to look for templates in. Default: templates Templates included with the recipe may also be used without specifying a template_dir.
Templates should be formatted using Python string formatting syntax. The dictionary used for the formatting operation is a flattened dictionary of the buildout settings and part settings.
For example, a trivial script template to list the files in the buildout installation directory would look like this:
#!/bin/bash # Sample buildout_script script template ls %(directory)
buildout_script ships with one script template, paster-check.sh.in, described below. Additional template contributions are welcome.
At Creative Commons we use Paste Script as the server for simple web applications. We run them using the --daemon flag, but occassionally something goes awry and the process dies. This template generates a script which can be called periodically from cron to ensure the process is still running. Note that this script can also be used to start the server if it is not already running.
Configuration parameters used by this script, which should be specified as settings in the zc.buildout part:
- The Paste Deploy configuration file to serve.
- The PID file to use when starting the server (and to subsequently check).
- The log file to use.
- Implemented template recipe for creating a non-executable file.
- Initial public release
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
|Filename, size & hash SHA256 hash help||File type||Python version||Upload date|
|buildout_script-0.2a1-py2.4.egg (11.0 kB) Copy SHA256 hash SHA256||Egg||2.4||Mar 14, 2007|
|buildout_script-0.2a1.tar.gz (5.3 kB) Copy SHA256 hash SHA256||Source||None||Mar 14, 2007|