Pre-release
This release is a pre-release and may not be stable for production use.
What is iw.recipe.cmd ?
This recipe is used to run one or more command lines
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 = 'touch %s' % test_file >>> write(sample_buildout, 'buildout.cfg', cfg % cmds)
Ok, so now we can touch a file:
>>> print system(buildout) Installing cmds. >>> 'test.txt' in os.listdir(sample_buildout) True
And remove it:
>>> test_file = join(sample_buildout, 'test.txt') >>> 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:
>>> cmds = ''' ... touch %s ... rm -f %s ... ''' % (test_file, test_file) >>> test_file = join(sample_buildout, 'test.txt') >>> 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 os.listdir(sample_buildout)
... >>> shutil.rmtree(os.path.join(sample_buildout, "bin"))
... >>> print 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'] ['.installed.cfg', 'buildout.cfg', 'develop-eggs', 'eggs', 'parts'] Installing py2. True
Release files for iw.recipe.cmd 0.1dev-r6594
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| iw.recipe.cmd-0.1dev_r6594-py2.4.egg | Legacy Egg format | - | - | Details |
Release files / iw.recipe.cmd-0.1dev_r6594-py2.4.egg
| Download URL | iw.recipe.cmd-0.1dev_r6594-py2.4.egg |
|---|---|
| Size | 10.0 kB |
| Tags | Egg |
|
SHA-256 checksum How to use checksums |
bfe152f513e7fa40be9c03831f50e4a6f82e62c36c9c2504b3a72e45e688d24b
|
|
BLAKE2b-256 checksum How to use checksums |
b487185ff8beb0a129a0644efed54e6aea669b17085f35886b7aade4a6da9297
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |