[svn] updated Jinja setup.py for (hopefully for) win32 compatibility
[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
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 build_extension(self, ext):
26         try:
27             build_ext.build_extension(self, ext)
28         except CCompilerError, e:
29             print '=' * 79
30             print 'INFORMATION'
31             print '  the speedup extension could not be compiled, Jinja will'
32             print '  fall back to the native python classes.'
33             print '=' * 79
34         except:
35             e = sys.exc_info()[1]
36             print '=' * 79
37             print 'WARNING'
38             print '  could not compile optional speedup extension. This is'
39             print '  is not a real problem because Jinja provides a native'
40             print '  implementation of those classes but for best performance'
41             print '  you could try to reinstall Jinja after fixing this'
42             print '  problem: %s' % e
43             print '=' * 79
44
45
46 setup(
47     name = 'Jinja',
48     version = '1.0',
49     url = 'http://jinja.pocoo.org/',
50     license = 'BSD',
51     author = 'Armin Ronacher',
52     author_email = 'armin.ronacher@active-4.com',
53     description = 'A small but fast and easy to use stand-alone template '
54                   'engine written in pure python.',
55     long_description = getdoc(jinja),
56     # jinja is egg safe. But because we distribute the documentation
57     # in form of html and txt files it's a better idea to extract the files
58     zip_safe = False,
59     classifiers = [
60         'Development Status :: 5 - Production/Stable',
61         'Environment :: Web Environment',
62         'Intended Audience :: Developers',
63         'License :: OSI Approved :: BSD License',
64         'Operating System :: OS Independent',
65         'Programming Language :: Python',
66         'Topic :: Internet :: WWW/HTTP :: Dynamic Content',
67         'Topic :: Software Development :: Libraries :: Python Modules',
68         'Topic :: Text Processing :: Markup :: HTML'
69     ],
70     keywords = ['python.templating.engines'],
71     packages = ['jinja', 'jinja.translators'],
72     data_files = [
73         ('docs', list(list_files('docs/build'))),
74         ('docs/txt', list(list_files('docs/src')))
75     ],
76     platforms = 'any',
77     entry_points='''
78     [python.templating.engines]
79     jinja = jinja.plugin:BuffetPlugin
80     ''',
81     extras_require = {'plugin': ['setuptools>=0.6a2']},
82     features = {'speedups': Feature(
83         'optional C-speed enhancements',
84         standard = True,
85         ext_modules = [
86             Extension('jinja._speedups', ['jinja/_speedups.c'])
87         ]
88     )},
89     cmdclass = {'build_ext': optional_build_ext}
90 )