Run `./2to3.py -w jinja2`
[jinja2.git] / setup.py
index e301fae9f71ec87bae8bd88328d04bb4694fb192..414795620a176ddcbe342103ebc7516dce8c5566 100644 (file)
--- a/setup.py
+++ b/setup.py
 # -*- coding: utf-8 -*-
-try:
-    import ez_setup
-    ez_setup.use_setuptools()
-except ImportError:
-    pass
-from setuptools import setup
-
-
-setup(
-    name = 'Jinja',
-    version = '0.9',
-    url = 'http://wsgiarea.pocoo.org/jinja/',
-    license = 'BSD',
-    author = 'Armin Ronacher',
-    author_email = 'armin.ronacher@active-4.com',
-    description = 'A small but fast and easy to use stand-alone template engine written in pure python.',
-    long_description = '''\
-Jinja is a small but very fast and easy to use stand-alone template engine
-written in pure Python.
-
-Since version 0.6 it uses a new parser that increases parsing performance
-a lot by caching the nodelists on disk if wanted.
-
-It includes multiple template inheritance and other features like simple
-value escaping.
-
-
-Template Syntax
-===============
-
-This is a small example template in which you can see how Jinja's syntax
-looks like::
-
-    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
-     "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
-    <html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">
-    <head>
-        <title>My Webpage</title>
-    </head
-    <body>
-        <ul id="navigation">
-        {% for item in navigation %}
-            <li><a href="{{ item.href }}">{{ item.caption|e }}</a></li>
-        {% endfor %}
-        </ul>
-
-        <h1>My Webpage</h1>
-        {{ variable }}
-    </body>
-    </html>
-
-
-Usage
-=====
-
-Here is a small example::
-
-    from jinja import Template, Context, FileSystemLoader
-
-    t = Template('mytemplate', FileSystemLoader('/path/to/the/templates'))
-    c = Context({
-        'navigation' [
-            {'href': '#', 'caption': 'Index'},
-            {'href': '#', 'caption': 'Spam'}
-        ],
-        'variable': '<strong>hello world</strong>'
-    })
-    print t.render(c)
-
-
-Unicode Support
-===============
+"""
+Jinja2
+~~~~~~
+
+Jinja2 is a template engine written in pure Python.  It provides a
+`Django`_ inspired non-XML syntax but supports inline expressions and
+an optional `sandboxed`_ environment.
+
+Nutshell
+--------
+
+Here a small example of a Jinja template::
+
+    {% extends 'base.html' %}
+    {% block title %}Memberlist{% endblock %}
+    {% block content %}
+      <ul>
+      {% for user in users %}
+        <li><a href="{{ user.url }}">{{ user.username }}</a></li>
+      {% endfor %}
+      </ul>
+    {% endblock %}
+
+Philosophy
+----------
+
+Application logic is for the controller but don't try to make the life
+for the template designer too hard by giving him too few functionality.
+
+For more informations visit the new `Jinja2 webpage`_ and `documentation`_.
+
+.. _sandboxed: http://en.wikipedia.org/wiki/Sandbox_(computer_security)
+.. _Django: http://www.djangoproject.com/
+.. _Jinja2 webpage: http://jinja.pocoo.org/
+.. _documentation: http://jinja.pocoo.org/2/documentation/
+"""
+import sys
+
+from setuptools import setup, Extension, Feature
+
+debugsupport = Feature(
+    'optional C debug support',
+    standard=False,
+    ext_modules = [
+        Extension('jinja2._debugsupport', ['jinja2/_debugsupport.c']),
+    ],
+)
 
-Jinja comes with built-in Unicode support. As a matter of fact, the return
-value of ``Template.render()`` will be a Python unicode object.
 
-You can still output ``str`` objects as well when you encode the result::
+# tell distribute to use 2to3 with our own fixers.
+extra = {}
+if sys.version_info >= (3, 0):
+    extra.update(
+        use_2to3=True,
+        use_2to3_fixers=['custom_fixers']
+    )
 
-    s = t.render(c).encode('utf-8')
+# ignore the old '--with-speedups' flag
+try:
+    speedups_pos = sys.argv.index('--with-speedups')
+except ValueError:
+    pass
+else:
+    sys.argv[speedups_pos] = '--with-debugsupport'
+    sys.stderr.write('*' * 74 + '\n')
+    sys.stderr.write('WARNING:\n')
+    sys.stderr.write('  the --with-speedups flag is deprecated, assuming '
+                     '--with-debugsupport\n')
+    sys.stderr.write('  For the actual speedups install the MarkupSafe '
+                     'package.\n')
+    sys.stderr.write('*' * 74 + '\n')
 
-For more examples check out the `documentation`_ on the `jinja webpage`_.
 
-.. _documentation: http://wsgiarea.pocoo.org/jinja/docs/
-.. _jinja webpage: http://wsgiarea.pocoo.org/jinja/
-''',
-    keywords = 'wsgi web templateengine templates',
-    packages = ['jinja'],
-    platforms = 'any',
-    classifiers = [
+setup(
+    name='Jinja2',
+    version='2.7-dev',
+    url='http://jinja.pocoo.org/',
+    license='BSD',
+    author='Armin Ronacher',
+    author_email='armin.ronacher@active-4.com',
+    description='A small but fast and easy to use stand-alone template '
+                'engine written in pure python.',
+    long_description=__doc__,
+    # jinja is egg safe. But we hate eggs
+    zip_safe=False,
+    classifiers=[
         'Development Status :: 5 - Production/Stable',
         'Environment :: Web Environment',
         'Intended Audience :: Developers',
         'License :: OSI Approved :: BSD License',
         'Operating System :: OS Independent',
         'Programming Language :: Python',
-        'Topic :: Internet :: WWW/HTTP',
-        'Topic :: Internet :: WWW/HTTP :: Dynamic Content'
-    ]
+        'Programming Language :: Python :: 3',
+        'Topic :: Internet :: WWW/HTTP :: Dynamic Content',
+        'Topic :: Software Development :: Libraries :: Python Modules',
+        'Topic :: Text Processing :: Markup :: HTML'
+    ],
+    packages=['jinja2', 'jinja2.testsuite', 'jinja2.testsuite.res',
+              'jinja2._markupsafe'],
+    extras_require={'i18n': ['Babel>=0.8']},
+    test_suite='jinja2.testsuite.suite',
+    include_package_data=True,
+    entry_points="""
+    [babel.extractors]
+    jinja2 = jinja2.ext:babel_extract[i18n]
+    """,
+    features={'debugsupport': debugsupport},
+    **extra
 )