setup.py
This file
Path
setup.py
139 lines · 4.0 KiB · Python
Last changed by
moved trans extension from jinja2.i18n to jinja2.ext and fixed some more unittestsArmin Ronacherbefore adoptionb5124e6
History of this fileTake it
The walk stopped after 200 commits: lines older than 88f69c6 point at it.
[svn] added missing commaArmin Ronacherbefore adoption88f69c6
line 1why, one step back1# -*- coding: utf-8 -*-Automated merge with ssh://team@pocoo.org/jinja-mainArmin Ronacherbefore adoption4cc239a
line 2why, one step back2"""inheritance uses a less awkward hack for contexts now and subclassing templates is possibleArmin Ronacherbefore adoption203bfcb
lines 3–4why, one step back3Jinja24~~~~~~Automated merge with ssh://team@pocoo.org/jinja-mainArmin Ronacherbefore adoption4cc239a
line 5why, one step back5inheritance uses a less awkward hack for contexts now and subclassing templates is possibleArmin Ronacherbefore adoption203bfcb
lines 6–8why, one step back6Jinja2 is a template engine written in pure Python. It provides a7`Django`_ inspired non-XML syntax but supports inline expressions and8an optional `sandboxed`_ environment.Automated merge with ssh://team@pocoo.org/jinja-mainArmin Ronacherbefore adoption4cc239a
lines 9–19why, one step back910Nutshell11--------1213Here a small example of a Jinja template::1415 {% extends 'base.html' %}16 {% block title %}Memberlist{% endblock %}17 {% block content %}18 <ul>19 {% for user in users %}inheritance uses a less awkward hack for contexts now and subclassing templates is possibleArmin Ronacherbefore adoption203bfcb
line 20why, one step back20 <li><a href="{{ user.url }}">{{ user.username }}</a></li>Automated merge with ssh://team@pocoo.org/jinja-mainArmin Ronacherbefore adoption4cc239a
lines 21–30why, one step back21 {% endfor %}22 </ul>23 {% endblock %}2425Philosophy26----------2728Application logic is for the controller but don't try to make the life29for the template designer too hard by giving him too few functionality.30inheritance uses a less awkward hack for contexts now and subclassing templates is possibleArmin Ronacherbefore adoption203bfcb
line 31why, one step back31For more informations visit the new `jinja2 webpage`_ and `documentation`_.Automated merge with ssh://team@pocoo.org/jinja-mainArmin Ronacherbefore adoption4cc239a
line 32why, one step back32inheritance uses a less awkward hack for contexts now and subclassing templates is possibleArmin Ronacherbefore adoption203bfcb
lines 33–34why, one step back33The `Jinja2 tip`_ is installable via `easy_install` with ``easy_install34Jinja2==dev``.Automated merge with ssh://team@pocoo.org/jinja-mainArmin Ronacherbefore adoption4cc239a
lines 35–37why, one step back3536.. _sandboxed: http://en.wikipedia.org/wiki/Sandbox_(computer_security)37.. _Django: http://www.djangoproject.com/inheritance uses a less awkward hack for contexts now and subclassing templates is possibleArmin Ronacherbefore adoption203bfcb
lines 38–40why, one step back38.. _jinja webpage: http://jinja2.pocoo.org/39.. _documentation: http://jinja2.pocoo.org/documentation/index.html40.. _Jinja tip: http://dev.pocoo.org/hg/jinja2-main/archive/tip.tar.gz#egg=Jinja2-devAutomated merge with ssh://team@pocoo.org/jinja-mainArmin Ronacherbefore adoption4cc239a
line 41why, one step back41"""[svn] added missing commaArmin Ronacherbefore adoption88f69c6
line 42why, one step back42import os[svn] updated Jinja setup.py for (hopefully for) win32 compatibilityArmin Ronacherbefore adoptiond15a4dc
line 43why, one step back43import sys[svn] added missing commaArmin Ronacherbefore adoption88f69c6
lines 44–46why, one step back44import ez_setup45ez_setup.use_setuptools()46added C escape and tb_set_next functionsArmin Ronacherbefore adoptionbd33f11
lines 47–49why, one step back47from setuptools import setup, Extension, Feature48from distutils.command.build_ext import build_ext49from distutils.errors import CCompilerError, DistutilsPlatformError[svn] added missing commaArmin Ronacherbefore adoption88f69c6
lines 50–60why, one step back505152def list_files(path):53 for fn in os.listdir(path):54 if fn.startswith('.'):55 continue56 fn = os.path.join(path, fn)57 if os.path.isfile(fn):58 yield fn5960inheritance uses a less awkward hack for contexts now and subclassing templates is possibleArmin Ronacherbefore adoption203bfcb
lines 61–72why, one step back61def get_terminal_width():62 """Return the current terminal dimensions."""63 try:64 from struct import pack, unpack65 from fcntl import ioctl66 from termios import TIOCGWINSZ67 s = pack('HHHH', 0, 0, 0, 0)68 return unpack('HHHH', ioctl(sys.stdout.fileno(), TIOCGWINSZ, s))[1]69 except:70 return 807172added C escape and tb_set_next functionsArmin Ronacherbefore adoptionbd33f11
lines 73–88why, one step back73class optional_build_ext(build_ext):74 """This class allows C extension building to fail."""7576 def run(self):77 try:78 build_ext.run(self)79 except DistutilsPlatformError:80 self._unavailable()8182 def build_extension(self, ext):83 try:84 build_ext.build_extension(self, ext)85 except CCompilerError, x:86 self._unavailable()8788 def _unavailable(self):inheritance uses a less awkward hack for contexts now and subclassing templates is possibleArmin Ronacherbefore adoption203bfcb
lines 89–90why, one step back89 width = get_terminal_width()90 print '*' * widthadded C escape and tb_set_next functionsArmin Ronacherbefore adoptionbd33f11
lines 91–93why, one step back91 print """WARNING:92An optional C extension could not be compiled, speedups will not be93available."""inheritance uses a less awkward hack for contexts now and subclassing templates is possibleArmin Ronacherbefore adoption203bfcb
line 94why, one step back94 print '*' * widthadded C escape and tb_set_next functionsArmin Ronacherbefore adoptionbd33f11
lines 95–96why, one step back9596[svn] added missing commaArmin Ronacherbefore adoption88f69c6
line 97why, one step back97setup(inheritance uses a less awkward hack for contexts now and subclassing templates is possibleArmin Ronacherbefore adoption203bfcb
line 98why, one step back98 name='Jinja2',update setup.py so that setup.py develop worksArmin Ronacherbefore adoption4a3038d
line 99why, one step back99 version='2.0dev',some documentation changesArmin Ronacherbefore adoption015b0c9
lines 100–105why, one step back100 url='http://jinja.pocoo.org/',101 license='BSD',102 author='Armin Ronacher',103 author_email='armin.ronacher@active-4.com',104 description='A small but fast and easy to use stand-alone template '105 'engine written in pure python.',added C escape and tb_set_next functionsArmin Ronacherbefore adoptionbd33f11
line 106why, one step back106 long_description=__doc__,[svn] added missing commaArmin Ronacherbefore adoption88f69c6
lines 107–108why, one step back107 # jinja is egg safe. But because we distribute the documentation108 # in form of html and txt files it's a better idea to extract the filessome documentation changesArmin Ronacherbefore adoption015b0c9
lines 109–110why, one step back109 zip_safe=False,110 classifiers=[added first code for parser extensions and moved some code in speedups aroundArmin Ronacherbefore adoptionf59bac2
line 111why, one step back111 'Development Status :: 4 Beta',[svn] added missing commaArmin Ronacherbefore adoption88f69c6
lines 112–120why, one step back112 'Environment :: Web Environment',113 'Intended Audience :: Developers',114 'License :: OSI Approved :: BSD License',115 'Operating System :: OS Independent',116 'Programming Language :: Python',117 'Topic :: Internet :: WWW/HTTP :: Dynamic Content',118 'Topic :: Software Development :: Libraries :: Python Modules',119 'Topic :: Text Processing :: Markup :: HTML'120 ],update setup.py so that setup.py develop worksArmin Ronacherbefore adoption4a3038d
line 121why, one step back121 packages=['jinja2'],some documentation changesArmin Ronacherbefore adoption015b0c9
line 122why, one step back122 data_files=[some more small release changesArmin Ronacherbefore adoption99e5baa
line 123why, one step back123 ('docs/html', list(list_files('docs/html'))),[svn] added missing commaArmin Ronacherbefore adoption88f69c6
lines 124–125why, one step back124 ('docs/txt', list(list_files('docs/src')))125 ],added C escape and tb_set_next functionsArmin Ronacherbefore adoptionbd33f11
lines 126–133why, one step back126 features={127 'speedups': Feature("optional C speed-enhancements",128 standard=True,129 ext_modules=[130 Extension('jinja2._speedups', ['jinja2/_speedups.c'])131 ]132 )133 },fixed setup.py, a type and removed the possibility to use multiple statements per block. The latter makes it easier to write custom tagsArmin Ronacherbefore adoption2b60fe5
line 134why, one step back134 extras_require={'i18n': ['Babel>=0.8']},added first code for parser extensions and moved some code in speedups aroundArmin Ronacherbefore adoptionf59bac2
lines 135–136why, one step back135 entry_points="""136 [babel.extractors]moved trans extension from jinja2.i18n to jinja2.ext and fixed some more unittestsArmin Ronacherbefore adoptionb5124e6
line 137why, one step back137 jinja2 = jinja.ext:babel_extract[i18n]added first code for parser extensions and moved some code in speedups aroundArmin Ronacherbefore adoptionf59bac2
line 138why, one step back138 """[svn] added missing commaArmin Ronacherbefore adoption88f69c6
line 139why, one step back139)