blob: e45aa0deba50b495623fdb5ff382ae158237ff11 [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
4import ez_setup
5ez_setup.use_setuptools()
Armin Ronacheree2c18e2007-04-20 22:39:04 +02006
7from distutils.command.build_ext import build_ext
8from distutils.errors import CCompilerError
9from setuptools import setup, Extension, Feature
Armin Ronacherae16fd02007-03-27 21:31:24 +020010from inspect import getdoc
Armin Ronacherde478f62007-02-28 22:35:04 +010011
Armin Ronacher0830e252007-03-22 23:45:30 +010012
Armin Ronachere21ced22007-03-22 23:57:10 +010013def 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
Armin Ronacheree2c18e2007-04-20 22:39:04 +020022class 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
Armin Ronacherde478f62007-02-28 22:35:04 +010038setup(
39 name = 'Jinja',
Armin Ronacher8ebf1f92007-03-03 11:22:18 +010040 version = '1.0',
41 url = 'http://jinja.pocoo.org/',
Armin Ronacherde478f62007-02-28 22:35:04 +010042 license = 'BSD',
43 author = 'Armin Ronacher',
44 author_email = 'armin.ronacher@active-4.com',
Armin Ronacher2b765132007-03-13 16:48:10 +010045 description = 'A small but fast and easy to use stand-alone template '
46 'engine written in pure python.',
Armin Ronacherae16fd02007-03-27 21:31:24 +020047 long_description = getdoc(jinja),
Armin Ronachere21ced22007-03-22 23:57:10 +010048 # 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,
Armin Ronacherde478f62007-02-28 22:35:04 +010051 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',
Armin Ronacher8ebf1f92007-03-03 11:22:18 +010058 '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'],
Armin Ronacher2b765132007-03-13 16:48:10 +010063 packages = ['jinja', 'jinja.translators'],
Armin Ronacher0830e252007-03-22 23:45:30 +010064 data_files = [
Armin Ronacher72bb2572007-03-23 17:24:48 +010065 ('docs', list(list_files('docs/build'))),
66 ('docs/txt', list(list_files('docs/src')))
Armin Ronacher0830e252007-03-22 23:45:30 +010067 ],
68 platforms = 'any',
Armin Ronacher21580912007-04-17 17:13:10 +020069 entry_points='''
70 [python.templating.engines]
71 jinja = jinja.plugin:BuffetPlugin
72 ''',
Armin Ronacheree2c18e2007-04-20 22:39:04 +020073 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}
Armin Ronacherde478f62007-02-28 22:35:04 +010082)