Armin Ronacher | de478f6 | 2007-02-28 22:35:04 +0100 | [diff] [blame] | 1 | # -*- coding: utf-8 -*- |
Armin Ronacher | ae16fd0 | 2007-03-27 21:31:24 +0200 | [diff] [blame] | 2 | import jinja |
Armin Ronacher | 0830e25 | 2007-03-22 23:45:30 +0100 | [diff] [blame] | 3 | import os |
Armin Ronacher | d15a4dc | 2007-05-28 18:16:16 +0200 | [diff] [blame^] | 4 | import sys |
Armin Ronacher | 0830e25 | 2007-03-22 23:45:30 +0100 | [diff] [blame] | 5 | import ez_setup |
| 6 | ez_setup.use_setuptools() |
Armin Ronacher | ee2c18e | 2007-04-20 22:39:04 +0200 | [diff] [blame] | 7 | |
| 8 | from distutils.command.build_ext import build_ext |
| 9 | from distutils.errors import CCompilerError |
| 10 | from setuptools import setup, Extension, Feature |
Armin Ronacher | ae16fd0 | 2007-03-27 21:31:24 +0200 | [diff] [blame] | 11 | from inspect import getdoc |
Armin Ronacher | de478f6 | 2007-02-28 22:35:04 +0100 | [diff] [blame] | 12 | |
Armin Ronacher | 0830e25 | 2007-03-22 23:45:30 +0100 | [diff] [blame] | 13 | |
Armin Ronacher | e21ced2 | 2007-03-22 23:57:10 +0100 | [diff] [blame] | 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 | |
Armin Ronacher | ee2c18e | 2007-04-20 22:39:04 +0200 | [diff] [blame] | 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' |
Armin Ronacher | d15a4dc | 2007-05-28 18:16:16 +0200 | [diff] [blame^] | 31 | print ' the speedup extension could not be compiled, Jinja will' |
Armin Ronacher | ee2c18e | 2007-04-20 22:39:04 +0200 | [diff] [blame] | 32 | print ' fall back to the native python classes.' |
| 33 | print '=' * 79 |
Armin Ronacher | d15a4dc | 2007-05-28 18:16:16 +0200 | [diff] [blame^] | 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 |
Armin Ronacher | ee2c18e | 2007-04-20 22:39:04 +0200 | [diff] [blame] | 44 | |
| 45 | |
Armin Ronacher | de478f6 | 2007-02-28 22:35:04 +0100 | [diff] [blame] | 46 | setup( |
| 47 | name = 'Jinja', |
Armin Ronacher | 8ebf1f9 | 2007-03-03 11:22:18 +0100 | [diff] [blame] | 48 | version = '1.0', |
| 49 | url = 'http://jinja.pocoo.org/', |
Armin Ronacher | de478f6 | 2007-02-28 22:35:04 +0100 | [diff] [blame] | 50 | license = 'BSD', |
| 51 | author = 'Armin Ronacher', |
| 52 | author_email = 'armin.ronacher@active-4.com', |
Armin Ronacher | 2b76513 | 2007-03-13 16:48:10 +0100 | [diff] [blame] | 53 | description = 'A small but fast and easy to use stand-alone template ' |
| 54 | 'engine written in pure python.', |
Armin Ronacher | ae16fd0 | 2007-03-27 21:31:24 +0200 | [diff] [blame] | 55 | long_description = getdoc(jinja), |
Armin Ronacher | e21ced2 | 2007-03-22 23:57:10 +0100 | [diff] [blame] | 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, |
Armin Ronacher | de478f6 | 2007-02-28 22:35:04 +0100 | [diff] [blame] | 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', |
Armin Ronacher | 8ebf1f9 | 2007-03-03 11:22:18 +0100 | [diff] [blame] | 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'], |
Armin Ronacher | 2b76513 | 2007-03-13 16:48:10 +0100 | [diff] [blame] | 71 | packages = ['jinja', 'jinja.translators'], |
Armin Ronacher | 0830e25 | 2007-03-22 23:45:30 +0100 | [diff] [blame] | 72 | data_files = [ |
Armin Ronacher | 72bb257 | 2007-03-23 17:24:48 +0100 | [diff] [blame] | 73 | ('docs', list(list_files('docs/build'))), |
| 74 | ('docs/txt', list(list_files('docs/src'))) |
Armin Ronacher | 0830e25 | 2007-03-22 23:45:30 +0100 | [diff] [blame] | 75 | ], |
| 76 | platforms = 'any', |
Armin Ronacher | 2158091 | 2007-04-17 17:13:10 +0200 | [diff] [blame] | 77 | entry_points=''' |
| 78 | [python.templating.engines] |
| 79 | jinja = jinja.plugin:BuffetPlugin |
| 80 | ''', |
Armin Ronacher | ee2c18e | 2007-04-20 22:39:04 +0200 | [diff] [blame] | 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} |
Armin Ronacher | de478f6 | 2007-02-28 22:35:04 +0100 | [diff] [blame] | 90 | ) |