cp.recipe.cmd

ZC Buildout recipe to execute commands in it's own shell
Download

cp.recipe.cmd Ranking & Summary

Advertisement

  • Rating:
  • License:
  • GPL
  • Publisher Name:
  • YUHSD

cp.recipe.cmd Tags


cp.recipe.cmd Description

ZC Buildout recipe to execute commands in it's own shell cp.recipe.cmd is a recipe used to run one or more command lines.Developer commentsI stole this from iw.recipe.cmd (http://pypi.python.org/pypi/iw.recipe.cmd/0.1)It works differently tho, when it comes to executing shell commands. iw.recipe.cmd would push each command out separately in it's own shell. Here I push them out to a shell script, and then run the shell script. This way things like CD and other things that require state within the shell work great.Options:shell= Set a shell to execute (default /bin/sh) (do not put the #!)on_install= whether to run or not on_install (defaults True)on_update= whether to run or not on_update (defaults True)install_cmd = Commands to run when install happens.update_cmd = Commands to run when an update happens.Also, I changed the way it works in the config file (example):recipe = cp.recipe.cmdshell = /bin/shinstall_cmd = echo "install commands go here" cd /tmp echo `pwd` echo 'see, I exist in one shell instance.'update_cmd = echo "update commands go here"On install, install_cmd will be turned into a shell script, and then ran. On update, update_cmd will be turned into a shell script and then ran. If you want update_cmds to be the same you can do something like this:update_cmd = ${commandexample:install_cmd}(where commandexample is the name of your part)I've added a new option shell=You can put whateer you want in there, sme nice examples:/usr/bin/env python(to run the python interpreter)the default is /bin/sh, so all your old code using this will work just fine.Also, I check the output of the script and if something returns >0 then CmdExecutionFailed is raised, along with the output of the error, and the path of where the script is, so you can see what was generated, do debugging, and fix it.A python example using the new shell= is here:parts = cmdsrecipe = cp.recipe.cmdshell=/usr/bin/env pythonupdate_cmd = f = open('testfile'.'w') f.write('this is a testfile') f.close() Requirements: · Python What's New in This Release: · Add HISTORY.txt to track release notes · Install hg plugin so HISTORY.txt makes it into distribution


cp.recipe.cmd Related Software