blob: a7086c2c3c6cce03e39765bc4dd6d0b688bd7d5b [file] [log] [blame]
Armin Ronacherde478f62007-02-28 22:35:04 +01001# -*- coding: utf-8 -*-
Armin Ronacherae16fd02007-03-27 21:31:24 +02002import jinja
Armin Ronacher0830e252007-03-22 23:45:30 +01003import os
Armin Ronacherd15a4dc2007-05-28 18:16:16 +02004import sys
Armin Ronacher0830e252007-03-22 23:45:30 +01005import ez_setup
6ez_setup.use_setuptools()
Armin Ronacheree2c18e2007-04-20 22:39:04 +02007
8from distutils.command.build_ext import build_ext
Armin Ronacherbc3d2d82007-10-19 15:49:56 +02009from distutils.errors import CCompilerError, DistutilsError
Armin Ronacheree2c18e2007-04-20 22:39:04 +020010from setuptools import setup, Extension, Feature
Armin Ronacherae16fd02007-03-27 21:31:24 +020011from inspect import getdoc
Armin Ronacherde478f62007-02-28 22:35:04 +010012
Armin Ronacher0830e252007-03-22 23:45:30 +010013
Armin Ronachere21ced22007-03-22 23:57:10 +010014def 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
Armin Ronacheree2c18e2007-04-20 22:39:04 +020023class optional_build_ext(build_ext):
24
Armin Ronacherbc3d2d82007-10-19 15:49:56 +020025 def run(self):
26 try:
27 build_ext.run(self)
28 except DistutilsError, e:
29 self.compiler = None
30 self._setup_error = e
31
Armin Ronacheree2c18e2007-04-20 22:39:04 +020032 def build_extension(self, ext):
33 try:
Armin Ronacherbc3d2d82007-10-19 15:49:56 +020034 if self.compiler is None:
35 raise self._setup_error
Armin Ronacheree2c18e2007-04-20 22:39:04 +020036 build_ext.build_extension(self, ext)
37 except CCompilerError, e:
38 print '=' * 79
39 print 'INFORMATION'
Armin Ronacherd15a4dc2007-05-28 18:16:16 +020040 print ' the speedup extension could not be compiled, Jinja will'
Armin Ronacheree2c18e2007-04-20 22:39:04 +020041 print ' fall back to the native python classes.'
42 print '=' * 79
Armin Ronacherd15a4dc2007-05-28 18:16:16 +020043 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
Armin Ronacheree2c18e2007-04-20 22:39:04 +020053
54
Armin Ronacherde478f62007-02-28 22:35:04 +010055setup(
Armin Ronacher015b0c92007-11-11 00:10:17 +010056 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.',
Armin Ronacherae16fd02007-03-27 21:31:24 +020064 long_description = getdoc(jinja),
Armin Ronachere21ced22007-03-22 23:57:10 +010065 # 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
Armin Ronacher015b0c92007-11-11 00:10:17 +010067 zip_safe=False,
68 classifiers=[
Armin Ronacherde478f62007-02-28 22:35:04 +010069 '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',
Armin Ronacher8ebf1f92007-03-03 11:22:18 +010075 'Topic :: Internet :: WWW/HTTP :: Dynamic Content',
76 'Topic :: Software Development :: Libraries :: Python Modules',
77 'Topic :: Text Processing :: Markup :: HTML'
78 ],
Armin Ronacher015b0c92007-11-11 00:10:17 +010079 keywords=['python.templating.engines'],
80 packages=['jinja', 'jinja.translators'],
81 data_files=[
Armin Ronacher72bb2572007-03-23 17:24:48 +010082 ('docs', list(list_files('docs/build'))),
83 ('docs/txt', list(list_files('docs/src')))
Armin Ronacher0830e252007-03-22 23:45:30 +010084 ],
Armin Ronacher21580912007-04-17 17:13:10 +020085 entry_points='''
86 [python.templating.engines]
87 jinja = jinja.plugin:BuffetPlugin
88 ''',
Armin Ronacher015b0c92007-11-11 00:10:17 +010089 extras_require={'plugin': ['setuptools>=0.6a2']},
90 features={
Armin Ronachera7804ef2007-06-15 18:03:21 +020091 '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 },
Armin Ronacher015b0c92007-11-11 00:10:17 +0100106 cmdclass={'build_ext': optional_build_ext}
Armin Ronacherde478f62007-02-28 22:35:04 +0100107)