Skip to main content
Warning: You are using the test version of PyPI. This is a pre-production deployment of Warehouse. Changes made here affect the production instance of TestPyPI (testpypi.python.org).
Help us improve Python packaging - Donate today!

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.

Repository: https://github.com/zartsoft/zsft.recipe.cmd

To clone:

git clone https://github.com/zartsoft/zsft.recipe.cmd

Issue tracker: https://github.com/zartsoft/zsft.recipe.cmd/issues

Supported Python versions: 2.7, 3.3+

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

Usage

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

Examples

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

[pythonscript]
recipe = zsft.recipe.cmd
shell = internal
install =
    os.chdir('${buildout:parts-directory}')
    if not os.path.exists('opt'):
        os.makedirs('opt')
    os.chdir('opt')
    check_call(['./config ; make'], shell=True)

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

[service-restart;windows]
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.

iw.recipe.cmd
Does not allow you to have different scripts for install and update. Specifying shell is POSIX only.
collective.recipe.cmd
Same limitations as in iw.recipe.cmd. Has uninstall_cmds and python mode.
plone.recipe.command
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.1 (2017-06-19)

  • Initial release.
Release History

Release History

This version
History Node

0.1.1

History Node

0.1

Download Files

Download Files

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

File Name & Checksum SHA256 Checksum Help Version File Type Upload Date
zsft.recipe.cmd-0.1.1-py2.py3-none-any.whl (7.1 kB) Copy SHA256 Checksum SHA256 py2.py3 Wheel Jun 19, 2017
zsft.recipe.cmd-0.1.1.tar.gz (4.9 kB) Copy SHA256 Checksum SHA256 Source Jun 19, 2017

Supported By

WebFaction WebFaction Technical Writing Elastic Elastic Search Pingdom Pingdom Monitoring Dyn Dyn DNS Sentry Sentry Error Logging CloudAMQP CloudAMQP RabbitMQ Heroku Heroku PaaS Kabu Creative Kabu Creative UX & Design Fastly Fastly CDN DigiCert DigiCert EV Certificate Rackspace Rackspace Cloud Servers DreamHost DreamHost Log Hosting