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