Welcome, guest | Sign In | My Account | Store | Cart

Notice! PyPM is being replaced with the ActiveState Platform, which enhances PyPM’s build and deploy capabilities. Create your free Platform account to download ActivePython or customize Python with the packages you require and get automatic updates.

Download
ActivePython
INSTALL>
pypm install collective.recipe.shelloutput

How to install collective.recipe.shelloutput

  1. Download and install ActivePython
  2. Open Command Prompt
  3. Type pypm install collective.recipe.shelloutput
 Python 2.7Python 3.2Python 3.3
Windows (32-bit)
0.1 Available View build log
Windows (64-bit)
0.1 Available View build log
Mac OS X (10.5+)
0.1 Available View build log
Linux (32-bit)
0.1 Available View build log
Linux (64-bit)
0.1 Available View build log
 
Author
License
ZPL
Dependencies
Lastest release
version 0.1 on Jan 5th, 2011
.. contents::

- Code repository: https://svn.plone.org/svn/collective/buildout/collective.recipe.shelloutput

Detailed Documentation
**********************

Exec shell commands and reuse the output
========================================

This recipe is for execute shell commands and get the output in another part of
the buildout. The commands are defined in a section called commands, one per
line and the output can be referenced from other parts using the ${...} syntax.

>>> write('dummy.py',
... '''
... class Recipe(object):
...
...     def __init__(self, buildout, name, options):
...         self.options = options
...
...     def install(self):
...         if 'output_1' in self.options:
...             print self.options['output_1']
...         if 'output_2' in self.options:
...             print self.options['output_2']
...         return ()
...
...     def update(self):
...         pass
... ''')

>>> write('setup.py',
... '''
... from setuptools import setup
...
... setup(name='dummyrecipe',
...       entry_points = {'zc.buildout': ['default = dummy:Recipe']})
... ''')

>>> write('buildout.cfg',
... '''
... [buildout]
... develop = .
... parts =
...     shelloutput
...     use-shelloutput
... offline = true
...
... [shelloutput]
... recipe = collective.recipe.shelloutput
... commands =
...     echo_1 = echo 'ECHO'
...     echo_2 = echo 'The shell says: hello.'
...
... [use-shelloutput]
... recipe = dummyrecipe
... output_1 = ${shelloutput:echo_1}
... output_2 = ${shelloutput:echo_2}
... ''')

>>> print system(join('bin', 'buildout')),
Develop: '/sample-buildout/.'
Installing shelloutput.
Installing use-shelloutput.
ECHO
The shell says: hello.


If we give an empty command we get a hint.

>>> write('buildout.cfg',
... '''
... [buildout]
... develop = .
... parts =
...     shelloutput
...     use-shelloutput
... offline = true
...
... [shelloutput]
... recipe = collective.recipe.shelloutput
... commands =
...     empty-cmd =
...
... [use-shelloutput]
... recipe = dummyrecipe
... output_1 = ${shelloutput:empty-cmd}
... ''')

>>> print system(join('bin', 'buildout')),
Develop: '/sample-buildout/.'
Uninstalling use-shelloutput.
Uninstalling shelloutput.
Installing shelloutput.
Installing use-shelloutput.
Empty command 'empty-cmd', no output generated.


If the execution of a command generates an error, we get the error message.

>>> write('buildout.cfg',
... '''
... [buildout]
... develop = .
... parts =
...     shelloutput
...     use-shelloutput
... offline = true
...
... [shelloutput]
... recipe = collective.recipe.shelloutput
... commands =
...     date = date -invalid-option
...
... [use-shelloutput]
... recipe = dummyrecipe
... output_1 = ${shelloutput:date}
... ''')

>>> print system(join('bin', 'buildout')),
Develop: '/sample-buildout/.'
Uninstalling use-shelloutput.
Uninstalling shelloutput.
Installing shelloutput.
Installing use-shelloutput.
Error 'date: invalid option ... for command 'date'...

Change history
**************

0.1 (2010-09-21)
----------------

- Initial release.
[j23d]

Download
********

Subscribe to package updates

Last updated Jan 5th, 2011

Download Stats

Last month:1

What does the lock icon mean?

Builds marked with a lock icon are only available via PyPM to users with a current ActivePython Business Edition subscription.

Need custom builds or support?

ActivePython Enterprise Edition guarantees priority access to technical support, indemnification, expert consulting and quality-assured language builds.

Plan on re-distributing ActivePython?

Get re-distribution rights and eliminate legal risks with ActivePython OEM Edition.