blob: b457c45355fa29ba534a8f4aa6b4093f73643b10 [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
9from distutils.errors import CCompilerError
10from 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
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'
Armin Ronacherd15a4dc2007-05-28 18:16:16 +020031 print ' the speedup extension could not be compiled, Jinja will'
Armin Ronacheree2c18e2007-04-20 22:39:04 +020032 print ' fall back to the native python classes.'
33 print '=' * 79
Armin Ronacherd15a4dc2007-05-28 18:16:16 +020034 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
Armin Ronacheree2c18e2007-04-20 22:39:04 +020044
45
Armin Ronacherde478f62007-02-28 22:35:04 +010046setup(
47 name = 'Jinja',
Armin Ronacher8ebf1f92007-03-03 11:22:18 +010048 version = '1.0',
49 url = 'http://jinja.pocoo.org/',
Armin Ronacherde478f62007-02-28 22:35:04 +010050 license = 'BSD',
51 author = 'Armin Ronacher',
52 author_email = 'armin.ronacher@active-4.com',
Armin Ronacher2b765132007-03-13 16:48:10 +010053 description = 'A small but fast and easy to use stand-alone template '
54 'engine written in pure python.',
Armin Ronacherae16fd02007-03-27 21:31:24 +020055 long_description = getdoc(jinja),
Armin Ronachere21ced22007-03-22 23:57:10 +010056 # 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,
Armin Ronacherde478f62007-02-28 22:35:04 +010059 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',
Armin Ronacher8ebf1f92007-03-03 11:22:18 +010066 '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'],
Armin Ronacher2b765132007-03-13 16:48:10 +010071 packages = ['jinja', 'jinja.translators'],
Armin Ronacher0830e252007-03-22 23:45:30 +010072 data_files = [
Armin Ronacher72bb2572007-03-23 17:24:48 +010073 ('docs', list(list_files('docs/build'))),
74 ('docs/txt', list(list_files('docs/src')))
Armin Ronacher0830e252007-03-22 23:45:30 +010075 ],
76 platforms = 'any',
Armin Ronacher21580912007-04-17 17:13:10 +020077 entry_points='''
78 [python.templating.engines]
79 jinja = jinja.plugin:BuffetPlugin
80 ''',
Armin Ronacheree2c18e2007-04-20 22:39:04 +020081 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}
Armin Ronacherde478f62007-02-28 22:35:04 +010090)