Skip to main content

WARNING: This package is deprecated. You should use collective.recipe.cmd

Change history

trunk (2008-04-22)

  • xxx [Ingeniweb]

0.3 (2008-04-22)

  • apply last version of the recipe template [gawel]

0.2 (2008-04-22)

  • run commands in one process [gawel]

  • win32 tests compat [gawel]

Detailed Documentation

Supported options

The recipe supports the following options:

on_install

true if the commands must run on install

on_update

true if the commands must run on update

cmds

a set of command lines

shell

a valid interpreter (POSIX only)

Example usage

We need a config file:

>>> cfg = """
... [buildout]
... parts = cmds
...
... [cmds]
... recipe = iw.recipe.cmd
... on_install=true
... cmds= %s
... """

>>> test_file = join(sample_buildout, 'test.txt')
>>> cmds = 'echo "bouh" > %s' % test_file
>>> write(sample_buildout, 'buildout.cfg', cfg % cmds)

Ok, so now we can touch a file for testing:

>>> print system(buildout)
Installing cmds.

>>> 'test.txt' in os.listdir(sample_buildout)
True

And remove it:

>>> test_file = join(sample_buildout, 'test.txt')
>>> if sys.platform == 'win32':
...    cmds = 'del %s' % test_file
... else:
...    cmds = 'rm -f %s' % test_file
>>> write(sample_buildout, 'buildout.cfg', cfg % cmds)

>>> print system(buildout)
Uninstalling cmds.
Installing cmds.

>>> 'test.txt' in os.listdir(sample_buildout)
False

We can run more than one commands:

>>> if sys.platform == 'win32':
...     cmds = '''
... echo "bouh" > %s
... del %s
... ''' % (test_file, test_file)
... else:
...     cmds = '''
... echo "bouh" > %s
... rm -f %s
... ''' % (test_file, test_file)

>>> test_file = join(sample_buildout, 'test.txt')
>>> if sys.platform == 'win32':
...     cmds = 'del %s' % test_file
... else:
...     cmds = 'rm -f %s' % test_file
>>> write(sample_buildout, 'buildout.cfg', cfg % cmds)

>>> print system(buildout)
Updating cmds.

>>> 'test.txt' in os.listdir(sample_buildout)
False

We can also run some python code:

>>> cfg = """
... [buildout]
... parts = py py2
...
... [py]
... recipe = iw.recipe.cmd:py
... on_install=true
... cmds=
...   >>> sample_buildout = buildout.get('directory', '.')
...   >>> print sorted(os.listdir(sample_buildout))
...   >>> os.remove(os.path.join(sample_buildout, ".installed.cfg"))
...   >>> print sorted(os.listdir(sample_buildout))
... [py2]
... recipe = iw.recipe.cmd:py
... on_install=true
... cmds=
...   >>> def myfunc(value):
...   ...     return value and True or False
...   >>> v = 20
...   >>> print myfunc(v)
... """

>>> write(sample_buildout, 'buildout.cfg', cfg)

Ok, so now we run it:

>>> print system(buildout)
Uninstalling cmds.
Installing py.
['.installed.cfg', 'bin', 'buildout.cfg', 'develop-eggs', 'eggs', 'parts']
['bin', 'buildout.cfg', 'develop-eggs', 'eggs', 'parts']
Installing py2.
True

Contributors

Gael Pasgrimaud

Download

Release files for iw.recipe.cmd 0.3

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for iw.recipe.cmd 0.3
File Size Uploaded
iw.recipe.cmd-0.3.tar.gz 6.5 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for iw.recipe.cmd 0.3
File Interpreter ABI Platform
iw.recipe.cmd-0.3-py2.4.egg Legacy Egg format - - Details

Total release size: 17.2 kB

Release files / iw.recipe.cmd-0.3.tar.gz

Download URL iw.recipe.cmd-0.3.tar.gz
Size 6.5 kB
Tags Source
SHA-256 checksum
How to use checksums
2664738a4f6c62124e1c412de0a4e6e6b3c493dfd82625394b1d063e9b221720
BLAKE2b-256 checksum
How to use checksums
c6949cebf7ecf811d72a8a2c51a652df088afbdba27a25fb21f4129c8366ddb6
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Release files / iw.recipe.cmd-0.3-py2.4.egg

Download URL iw.recipe.cmd-0.3-py2.4.egg
Size 10.7 kB
Tags Egg
SHA-256 checksum
How to use checksums
e789fc6266d750666a012039023251607815117d54943228d9e264f6f63dc564
BLAKE2b-256 checksum
How to use checksums
54ad83801085fdc10783187dc74e5308946d152f391c10a150cb7d410bca8e06
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page