ZC buildout recipe to build template based file
Project description
================
iw.recipe.template package
================
.. contents::
What is iw.recipe.template ?
==================
Explain here what is the purpose of iw.recipe.template.
How to use iw.recipe.template ?
=====================
We need some buildout vars::
>>> data_dir = join(test_dir, 'data')
>>> parts_dir = join(data_dir, 'parts')
>>> buildout = {'instance': {'location': test_dir},
... 'buildout': {'directory': test_dir,
... 'install-from-cache': False,
... 'download-cache':False,
... 'parts-directory': parts_dir}}
>>> name = 'template'
And a template::
>>> template = join(data_dir, 'template.py_impl')
>>> open(template, 'w').write('''My template is named "$name"''')
Then, the recipe should work::
>>> from iw.recipe.template import Recipe
>>> options = {}
>>> options['source'] = template
>>> options['destination'] = join(data_dir, 'template.py')
>>> recipe = Recipe(buildout, name, options)
>>> filename = recipe.install()
Here is the result::
>>> print open(options['destination']).read()
My template is named "template"
iw.recipe.template package
================
.. contents::
What is iw.recipe.template ?
==================
Explain here what is the purpose of iw.recipe.template.
How to use iw.recipe.template ?
=====================
We need some buildout vars::
>>> data_dir = join(test_dir, 'data')
>>> parts_dir = join(data_dir, 'parts')
>>> buildout = {'instance': {'location': test_dir},
... 'buildout': {'directory': test_dir,
... 'install-from-cache': False,
... 'download-cache':False,
... 'parts-directory': parts_dir}}
>>> name = 'template'
And a template::
>>> template = join(data_dir, 'template.py_impl')
>>> open(template, 'w').write('''My template is named "$name"''')
Then, the recipe should work::
>>> from iw.recipe.template import Recipe
>>> options = {}
>>> options['source'] = template
>>> options['destination'] = join(data_dir, 'template.py')
>>> recipe = Recipe(buildout, name, options)
>>> filename = recipe.install()
Here is the result::
>>> print open(options['destination']).read()
My template is named "template"
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.template-0.1dev_r6578-py2.4.egg
.
File metadata
- Download URL: iw.recipe.template-0.1dev_r6578-py2.4.egg
- Upload date:
- Size: 8.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 009ccbc2aad0d1455ef4d75927a8aca0d472a18b99e9b7f95d88a8cc1101a0a2 |
|
MD5 | 6bda5adfd254c1e8f1772833c67d1553 |
|
BLAKE2b-256 | 5506bf80022f8da254a189bf540cb7388029eda0c0043cc73c0d1ba437548c89 |