ZC Buildout recipe to execute a commande line
Project description
This recipe is used to run one or more command lines
We need some buildout vars:
>>> import os >>> join = os.path.join >>> data_dir = join(test_dir, 'data') >>> parts_dir = join(data_dir, 'parts') >>> buildout = {'instance': {'location': test_dir}, ... 'buildout': {'directory': test_dir, ... 'parts-directory': test_dir}} >>> name = 'cmds'
Ok, so now we can touch a file in data_dir:
>>> test_file = join(data_dir, 'test.txt') >>> options = {'cmds': 'touch %s' % test_file} >>> from iw.recipe.cmd import Recipe >>> recipe = Recipe(buildout, name, options) >>> path = recipe.install() >>> 'test.txt' in os.listdir(data_dir) True
And remove it:
>>> options = {'cmds': 'rm -f %s' % test_file} >>> recipe = Recipe(buildout, name, options) >>> path = recipe.install() >>> 'test.txt' in os.listdir(data_dir) False
We can run more than one commands:
>>> cmds = ''' ... touch %s ... rm -f %s ... ''' % (test_file, test_file) >>> recipe = Recipe(buildout, name, options) >>> path = recipe.install() >>> 'test.txt' in os.listdir(data_dir) False
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distributions
No source distribution files available for this release.See tutorial on generating distribution archives.
Built Distribution
File details
Details for the file iw.recipe.cmd-0.1dev_r6515-py2.4.egg
.
File metadata
- Download URL: iw.recipe.cmd-0.1dev_r6515-py2.4.egg
- Upload date:
- Size: 8.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 4a69875e2f06beb30ef25b0dd88a165f93b91f36a0719186d0dddba9a8e1eb7d |
|
MD5 | 95ea3379062c48cffe73a965a5375d35 |
|
BLAKE2b-256 | ce24f80ab052be8f0114c2b5316d8a5b623dd774dd582aafdb88507c2d74159b |