[svn] added c implementation of the jinja context class.
--HG--
branch : trunk
diff --git a/setup.py b/setup.py
index 4943932..e45aa0d 100644
--- a/setup.py
+++ b/setup.py
@@ -3,7 +3,10 @@
import os
import ez_setup
ez_setup.use_setuptools()
-from setuptools import setup
+
+from distutils.command.build_ext import build_ext
+from distutils.errors import CCompilerError
+from setuptools import setup, Extension, Feature
from inspect import getdoc
@@ -16,6 +19,22 @@
yield fn
+class optional_build_ext(build_ext):
+
+ def build_extension(self, ext):
+ try:
+ build_ext.build_extension(self, ext)
+ except CCompilerError, e:
+ print '=' * 79
+ print 'INFORMATION'
+ print ' the speedup extension could not be compiled, jinja will'
+ print ' fall back to the native python classes.'
+ print '=' * 79
+
+
+
+
+
setup(
name = 'Jinja',
version = '1.0',
@@ -51,5 +70,13 @@
[python.templating.engines]
jinja = jinja.plugin:BuffetPlugin
''',
- extras_require = {'plugin': ['setuptools>=0.6a2']}
+ extras_require = {'plugin': ['setuptools>=0.6a2']},
+ features = {'speedups': Feature(
+ 'optional C-speed enhancements',
+ standard = True,
+ ext_modules = [
+ Extension('jinja._speedups', ['jinja/_speedups.c'])
+ ]
+ )},
+ cmdclass = {'build_ext': optional_build_ext}
)