Skip to main content

Buildout recipe to execute commands via shell or python

Project description

This recipe allows you to run arbitrary shell and python scripts from buildout. It’s inspired by similar recipes but has few added features.


To clone:

git clone

Issue tracker:

Supported Python versions: 2.7, 3.3+

Supported zc.buildout versions: 1.x, 2.x.


Commands to execute on install phase.
Commands to execute on update phase.
Shell to run script with. If not set uses default system shell. Special value internal means executing as python code from buildout.
Can override shell for install phase.
Can override shell for update phase.
Additional switch to shell, like -File for PowerShell, -f for Awk, etc.
Can override shell options for install phase.
Can override shell options for update phase.
List of KEY=VALUE pairs to set environment variables.


recipe = zsft.recipe.cmd
install =
    ./configure --prefix=${buildout:parts-directory}/opt
    make install
env =
    CFLAGS = -g -Wall -O2
    LDFLAGS = -lm
    LD_RUN_PATH = $ORIGIN/../lib

recipe = zsft.recipe.cmd
shell = internal
install =
    if not os.path.exists('opt'):
    check_call(['./config ; make'], shell=True)

recipe = zsft.recipe.cmd
configuration = Release
platform = Win32
install =
    msbuild.exe /t:Build /p:Configuration=${:configuration} /p:Platform=${:platform}

recipe = zsft.recipe.cmd
shell = powershell.exe
shell-options = -File
service = foo
update =
    $service = "${:service}"
    Write-Host -ForegroundColor Yellow "Restarting service '$service'"
    Restart-Service -Verbose $service

Difference from other recipes

Unlike other similar recipes this one allows you to specify custom shell on Windows and environment variables.

Does not allow you to have different scripts for install and update. Specifying shell is POSIX only.
Same limitations as in iw.recipe.cmd. Has uninstall_cmds and python mode.
Has stop-on-error option and allows different scripts for install/update. Does not seem to allow multiline commands or custom shells.

Change history

0.4 (2017-06-21)

  • Fix environment parser
  • Fix conditional section syntax in example
  • Cleanup logging

0.3.1 (2017-06-21)

  • Fix shell options when no shell is passed.

0.3 (2017-06-21)

  • Run shell explicitly. Fixes running on POSIX.

0.2 (2017-06-20)

  • Fix for re-running install script.

0.1 (2017-06-20)

  • Initial release.

Project details

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for zsft.recipe.cmd, version 0.4
Filename, size File type Python version Upload date Hashes
Filename, size zsft.recipe.cmd-0.4-py2.py3-none-any.whl (7.4 kB) File type Wheel Python version py2.py3 Upload date Hashes View
Filename, size zsft.recipe.cmd-0.4.tar.gz (5.2 kB) File type Source Python version None Upload date Hashes View

Supported by

Pingdom Pingdom Monitoring Google Google Object Storage and Download Analytics Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN DigiCert DigiCert EV certificate StatusPage StatusPage Status page