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 iw.recipe.template

How to install iw.recipe.template

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

What is iw.recipe.template ?

iw.recipe.template is a zc.buildout recipe to build template based file/scripts

It also provide some recipe to build Zope2, Zope3 and Squid vhosts config file for apache.

How to use iw.recipe.template ?

We need a buildout config file:

>>> server = start_server(test_dir)
>>> write(sample_buildout, 'buildout.cfg',
... """
... [buildout]
... parts = template.txt
...
... [template.txt]
... recipe = iw.recipe.template
... source = %s/template.txt_impl
... destination = %s/
... """ % (sample_buildout, sample_buildout))

And a template:

>>> template = join(sample_buildout, 'template.txt_impl')
>>> open(template, 'w').write('''My template is named "$name"''')

Then, the recipe should work:

>>> print system(buildout)

System Message: ERROR/3 (<string>, line 43)

Inconsistent literal block quoting.

Installing template.txt. template.txt: Generated file 'template.txt'.

Here is the result:

>>> print open(join(sample_buildout, 'template.txt')).read()

System Message: ERROR/3 (<string>, line 49)

Inconsistent literal block quoting.

My template is named "template.txt"

Now we can generate an executable:

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

System Message: ERROR/3 (<string>, line 55)

Inconsistent literal block quoting.

... """ ... [buildout] ... parts = script ... ... [script] ... recipe = iw.recipe.template:script ... source = %s/template.py_impl ... destination = %s/ ... """ % (sample_buildout, sample_buildout))

We need a small template with a python script:

>>> template = join(sample_buildout, 'template.py_impl')
>>> open(template, 'w').write('''

System Message: ERROR/3 (<string>, line 70)

Inconsistent literal block quoting.

... import sys ... print 'this is the script named "$name"' ... ''')

Run buildout again:

>>> print system(buildout)

System Message: ERROR/3 (<string>, line 77)

Inconsistent literal block quoting.

Uninstalling template.txt. Installing script. script: Generated script 'script'.

Here is the result:

>>> print open(join(sample_buildout, 'script')).read()

System Message: ERROR/3 (<string>, line 84)

Inconsistent literal block quoting.

#!/.../bin/python <BLANKLINE> import sys print 'this is the script named "script"' <BLANKLINE>

>>> print system(join(sample_buildout, 'script'))
this is the script named "script"

Subscribe to package updates

Last updated Jan 5th, 2011

Download Stats

Last month:5

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.