Skip to content
Myr

Propably delaying release for better python 3 support. Started working on

Before adoption: this commit came in with the history the project adopted, so no landing records it.

that. --HG-- branch : trunk

authored by Armin Ronacher · committed by Armin Ronacher · parent 0319c66 · Browse files · 10 files+45 added−62 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

10 files+45 added−62 removed

  • other:+45 added−62 removed

10 files+45 added−62 removed

added:custom_fixers/__init__.py
added:custom_fixers/fix_alt_unicode.py+24 added
1from lib2to3 import fixer_base2from lib2to3.fixer_util import Name, BlankLine345class FixAltUnicode(fixer_base.BaseFix):6 PATTERN = """7 func=funcdef< 'def' name=NAME8 parameters< '(' NAME ')' > any+ >9 """1011 run_order = 51213 def transform(self, node, results):14 name = results['name']1516 # rename __unicode__ to __str__17 if name.value == '__unicode__':18 name.replace(Name('__str__', prefix=name.prefix))1920 # get rid of other __str__'s21 elif name.value == '__str__':22 next = BlankLine()23 next.prefix = results['func'].prefix24 return next
deleted:jinja2/_ipysupport.py-40 removed
1# -*- coding: utf-8 -*-2"""3 jinja2._ipysupport4 ~~~~~~~~~~~~~~~~~~56 IronPython support library. This library exports functionality from7 the CLR to Python that is normally available in the standard library.89 :copyright: (c) 2010 by the Jinja Team.10 :license: BSD.11"""12from System import DateTime13from System.IO import Path, File, FileInfo141516epoch = DateTime(1970, 1, 1)171819class _PathModule(object):20 """A minimal path module."""2122 sep = str(Path.DirectorySeparatorChar)23 altsep = str(Path.AltDirectorySeparatorChar)24 pardir = '..'2526 def join(self, path, *args):27 args = list(args[::-1])28 while args:29 path = Path.Combine(path, args.pop())30 return path3132 def isfile(self, filename):33 return File.Exists(filename)3435 def getmtime(self, filename):36 info = FileInfo(filename)37 return int((info.LastAccessTimeUtc - epoch).TotalSeconds)383940path = _PathModule()
modified:jinja2/bccache.py+3 added-3 removed
106 unmodified lines
107108 def load_bytecode(self, bucket):109 filename = path.join(self.directory, bucket.key)110 if path.exists(filename):111 with file(filename, 'rb') as f:111 with open(filename, 'rb') as f:112 bucket.load_bytecode(f)113114 def dump_bytecode(self, bucket):115 filename = path.join(self.directory, bucket.key)116 with file(filename, 'wb') as f:116 with open(filename, 'wb') as f:117 bucket.write_bytecode(f)118119 A more advanced version of a filesystem based bytecode cache is part of120 Jinja2.
80 unmodified lines
201 finally:202 f.close()203204 def dump_bytecode(self, bucket):205 f = file(self._get_cache_filename(bucket), 'wb')205 f = open(self._get_cache_filename(bucket), 'wb')206 try:207 bucket.write_bytecode(f)208 finally:209 f.close()
71 unmodified lines
modified:jinja2/environment.py+5 added-2 removed
806 unmodified lines
807 self._body_stream = list(template.root_render_func(context))808 self.__dict__.update(context.get_exported())809 self.__name__ = template.name810811 __unicode__ = lambda x: concat(x._body_stream)812 __html__ = lambda x: Markup(concat(x._body_stream))811 def __unicode__(self):812 return concat(self._body_stream)813814 def __html__(self):815 return Markup(concat(self._body_stream))816817 def __str__(self):818 return unicode(self).encode('utf-8')819820 def __repr__(self):
110 unmodified lines
modified:jinja2/runtime.py+2 added-2 removed
515 unmodified lines
516 ...517 UndefinedError: 'foo' is undefined518 """519 __slots__ = ()520 __iter__ = __unicode__ = __len__ = __nonzero__ = __eq__ = __ne__ = \521 Undefined._fail_with_undefined_error520 __iter__ = __unicode__ = __str__ = __len__ = __nonzero__ = __eq__ = \521 __ne__ = Undefined._fail_with_undefined_error522523524# remove remaining slots attributes, after the metaclass did the magic they525# are unneeded and irritating as they contain wrong data for the subclasses.
1 unmodified line
modified:jinja2/utils.py+1 added-1 removed
196 unmodified lines
197 if not silent:198 raise199200201def open_if_exists(filename, mode='r'):201def open_if_exists(filename, mode='rb'):202 """Returns a file descriptor for the filename if that file exists,203 otherwise `None`.204 """205 try:
579 unmodified lines
modified:.hgignore-1 removed
5 unmodified lines
6\.py[cod]$7\$py\.class$8\.DS_Store$9^j?env/10^py3k/
modified:Makefile+2 added-6 removed
1test:2 nosetests --with-doctest jinja2 tests342to3:5 rm -rf py3k6 mkdir py3k7 cp -R jinja2 py3k8 cp -R tests py3k9 2to3 jinja2 tests > py3k/convert.patch10 cd py3k; patch -p0 < convert.patch5 rm -rf build/lib6 python3 setup.py build78.PHONY: test
modified:setup.py+8 added-7 removed
41 unmodified lines
42import os43import sys4445from setuptools import setup, Extension, Feature46from distutils.command.build_ext import build_ext47from distutils.errors import CCompilerError, DistutilsPlatformError4649try:50 from distutils.command.build_py import build_py_2to3 as build_py51except ImportError:52 from distutils.command.build_py import build_py47# tell distribute to use 2to3 with our own fixers.48extra = {}49if sys.version_info >= (3, 0):50 extra.update(51 use_2to3=True,52 use_2to3_fixers=['custom_fixers']53 )545556setup(57 name='Jinja2',
31 unmodified lines
89 entry_points="""90 [babel.extractors]91 jinja2 = jinja2.ext:babel_extract[i18n]92 """,92 cmdclass=dict(build_py=build_py)93 **extra94)