setup.py
This file
Path
setup.py
107 lines · 3.4 KiB · Python
Last changed by
added jinja.contrib to setup.pyArmin Ronacherbefore adoption21dce51
History of this fileTake it
1# -*- coding: utf-8 -*-2import jinja3import os4import sys5import ez_setup6ez_setup.use_setuptools()78from distutils.command.build_ext import build_ext9from distutils.errors import CCompilerError, DistutilsError10from setuptools import setup, Extension, Feature11from inspect import getdoc121314def list_files(path):15 for fn in os.listdir(path):16 if fn.startswith('.'):17 continue18 fn = os.path.join(path, fn)19 if os.path.isfile(fn):20 yield fn212223class optional_build_ext(build_ext):2425 def run(self):26 try:27 build_ext.run(self)28 except DistutilsError, e:29 self.compiler = None30 self._setup_error = e3132 def build_extension(self, ext):33 try:34 if self.compiler is None:35 raise self._setup_error36 build_ext.build_extension(self, ext)37 except CCompilerError, e:38 print '=' * 7939 print 'INFORMATION'40 print ' the speedup extension could not be compiled, Jinja will'41 print ' fall back to the native python classes.'42 print '=' * 7943 except:44 e = sys.exc_info()[1]45 print '=' * 7946 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' % e52 print '=' * 79535455setup(56 name='Jinja',57 version='1.3',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 documentation66 # in form of html and txt files it's a better idea to extract the files67 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', 'jinja.contrib'],81 data_files=[82 ('docs/html', list(list_files('docs/html'))),83 ('docs/txt', list(list_files('docs/src')))84 ],85 entry_points='''86 [python.templating.engines]87 jinja = jinja.plugin:BuffetPlugin88 ''',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)