[svn] added c implementation of the jinja context class.
[jinja2.git] / setup.py
1 # -*- coding: utf-8 -*-
2 import jinja
3 import os
4 import ez_setup
5 ez_setup.use_setuptools()
6
7 from distutils.command.build_ext import build_ext
8 from distutils.errors import CCompilerError
9 from setuptools import setup, Extension, Feature
10 from inspect import getdoc
11
12
13 def list_files(path):
14     for fn in os.listdir(path):
15         if fn.startswith('.'):
16             continue
17         fn = os.path.join(path, fn)
18         if os.path.isfile(fn):
19             yield fn
20
21
22 class optional_build_ext(build_ext):
23
24     def build_extension(self, ext):
25         try:
26             build_ext.build_extension(self, ext)
27         except CCompilerError, e:
28             print '=' * 79
29             print 'INFORMATION'
30             print '  the speedup extension could not be compiled, jinja will'
31             print '  fall back to the native python classes.'
32             print '=' * 79
33
34
35
36
37
38 setup(
39     name = 'Jinja',
40     version = '1.0',
41     url = 'http://jinja.pocoo.org/',
42     license = 'BSD',
43     author = 'Armin Ronacher',
44     author_email = 'armin.ronacher@active-4.com',
45     description = 'A small but fast and easy to use stand-alone template '
46                   'engine written in pure python.',
47     long_description = getdoc(jinja),
48     # jinja is egg safe. But because we distribute the documentation
49     # in form of html and txt files it's a better idea to extract the files
50     zip_safe = False,
51     classifiers = [
52         'Development Status :: 5 - Production/Stable',
53         'Environment :: Web Environment',
54         'Intended Audience :: Developers',
55         'License :: OSI Approved :: BSD License',
56         'Operating System :: OS Independent',
57         'Programming Language :: Python',
58         'Topic :: Internet :: WWW/HTTP :: Dynamic Content',
59         'Topic :: Software Development :: Libraries :: Python Modules',
60         'Topic :: Text Processing :: Markup :: HTML'
61     ],
62     keywords = ['python.templating.engines'],
63     packages = ['jinja', 'jinja.translators'],
64     data_files = [
65         ('docs', list(list_files('docs/build'))),
66         ('docs/txt', list(list_files('docs/src')))
67     ],
68     platforms = 'any',
69     entry_points='''
70     [python.templating.engines]
71     jinja = jinja.plugin:BuffetPlugin
72     ''',
73     extras_require = {'plugin': ['setuptools>=0.6a2']},
74     features = {'speedups': Feature(
75         'optional C-speed enhancements',
76         standard = True,
77         ext_modules = [
78             Extension('jinja._speedups', ['jinja/_speedups.c'])
79         ]
80     )},
81     cmdclass = {'build_ext': optional_build_ext}
82 )