1 # -*- coding: utf-8 -*-
6 Jinja is a `sandboxed`_ template engine written in pure Python. It
7 provides a `Django`_ like non-XML syntax and compiles templates into
8 executable python code. It's basically a combination of Django templates
14 Here a small example of a Jinja template::
16 {% extends 'base.html' %}
17 {% block title %}Memberlist{% endblock %}
20 {% for user in users %}
21 <li><a href="{{ user.url|e }}">{{ user.username|e }}</a></li>
29 Application logic is for the controller but don't try to make the life
30 for the template designer too hard by giving him too few functionality.
32 For more informations visit the new `jinja webpage`_ and `documentation`_.
37 This is the Jinja 1.0 release which is completely incompatible with the
38 old "pre 1.0" branch. The old branch will still receive security updates
39 and bugfixes but the 1.0 branch will be the only version that receives
42 If you have an application that uses Jinja 0.9 and won't be updated in
43 the near future the best idea is to ship a Jinja 0.9 checkout together
46 The `Jinja tip`_ is installable via `easy_install` with ``easy_install
49 .. _sandboxed: http://en.wikipedia.org/wiki/Sandbox_(computer_security)
50 .. _Django: http://www.djangoproject.com/
51 .. _jinja webpage: http://jinja.pocoo.org/
52 .. _documentation: http://jinja.pocoo.org/documentation/index.html
53 .. _Jinja tip: http://dev.pocoo.org/hg/jinja-main/archive/tip.tar.gz#egg=Jinja-dev
58 ez_setup.use_setuptools()
60 from distutils.command.build_ext import build_ext
61 from distutils.errors import CCompilerError, DistutilsError
62 from setuptools import setup, Extension, Feature
66 for fn in os.listdir(path):
67 if fn.startswith('.'):
69 fn = os.path.join(path, fn)
70 if os.path.isfile(fn):
74 class optional_build_ext(build_ext):
79 except DistutilsError, e:
83 def build_extension(self, ext):
85 if self.compiler is None:
86 raise self._setup_error
87 build_ext.build_extension(self, ext)
88 except CCompilerError, e:
91 print ' the speedup extension could not be compiled, Jinja will'
92 print ' fall back to the native python classes.'
98 print ' could not compile optional speedup extension. This is'
99 print ' is not a real problem because Jinja provides a native'
100 print ' implementation of those classes but for best performance'
101 print ' you could try to reinstall Jinja after fixing this'
102 print ' problem: %s' % e
109 url='http://jinja.pocoo.org/',
111 author='Armin Ronacher',
112 author_email='armin.ronacher@active-4.com',
113 description='A small but fast and easy to use stand-alone template '
114 'engine written in pure python.',
115 long_description = __doc__,
116 # jinja is egg safe. But because we distribute the documentation
117 # in form of html and txt files it's a better idea to extract the files
120 'Development Status :: 5 - Production/Stable',
121 'Environment :: Web Environment',
122 'Intended Audience :: Developers',
123 'License :: OSI Approved :: BSD License',
124 'Operating System :: OS Independent',
125 'Programming Language :: Python',
126 'Topic :: Internet :: WWW/HTTP :: Dynamic Content',
127 'Topic :: Software Development :: Libraries :: Python Modules',
128 'Topic :: Text Processing :: Markup :: HTML'
130 keywords=['python.templating.engines'],
131 packages=['jinja', 'jinja.translators', 'jinja.contrib'],
133 ('docs/html', list(list_files('docs/html'))),
134 ('docs/txt', list(list_files('docs/src')))
137 [python.templating.engines]
138 jinja = jinja.plugin:BuffetPlugin
140 extras_require={'plugin': ['setuptools>=0.6a2']},
143 'optional C-speed enhancements',
146 Extension('jinja._speedups', ['jinja/_speedups.c'])
149 'extended-debugger': Feature(
153 Extension('jinja._debugger', ['jinja/_debugger.c'])
157 cmdclass={'build_ext': optional_build_ext}