- Update to 2.10.3:

* Fix Python 3.7 deprecation warnings.
  * Using range in the sandboxed environment uses xrange on Python 2 to avoid memory use. :issue:`933`
  * Use Python 3.7's better traceback support to avoid a core dump when using debug builds of Python 3.7. :issue:`1050`
  * Fix a typo in Babel entry point in setup.py that was preventing installation.
- Remove merged python38.patch

OBS-URL: https://build.opensuse.org/package/show/devel:languages:python/python-Jinja2?expand=0&rev=74
This commit is contained in:
Tomáš Chvátal 2019-10-07 13:42:06 +00:00 committed by Git OBS Bridge
parent ebf628bfa2
commit 3bb888be77
5 changed files with 22 additions and 213 deletions

View File

@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:065c4f02ebe7f7cf559e49ee5a95fb800a9e4528727aec6f24402a5374c65013
size 260956

3
Jinja2-2.10.3.tar.gz Normal file
View File

@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:9fe95f19286cfefaa917656583d020be14e7859c6b0252588391e47db34527de
size 257888

View File

@ -1,3 +1,13 @@
-------------------------------------------------------------------
Mon Oct 7 13:37:05 UTC 2019 - Tomáš Chvátal <tchvatal@suse.com>
- Update to 2.10.3:
* Fix Python 3.7 deprecation warnings.
* Using range in the sandboxed environment uses xrange on Python 2 to avoid memory use. :issue:`933`
* Use Python 3.7's better traceback support to avoid a core dump when using debug builds of Python 3.7. :issue:`1050`
* Fix a typo in Babel entry point in setup.py that was preventing installation.
- Remove merged python38.patch
-------------------------------------------------------------------
Tue Sep 24 11:06:41 UTC 2019 - Tomáš Chvátal <tchvatal@suse.com>

View File

@ -19,17 +19,16 @@
%{?!python_module:%define python_module() python-%{**} python3-%{**}}
%define oldpython python
Name: python-Jinja2
Version: 2.10.1
Version: 2.10.3
Release: 0
Summary: A template engine written in pure Python
License: BSD-3-Clause
Group: Development/Languages/Python
URL: http://jinja.pocoo.org/
URL: https://github.com/pallets/jinja
Source: https://files.pythonhosted.org/packages/source/J/Jinja2/Jinja2-%{version}.tar.gz
Patch0: python38.patch
BuildRequires: %{python_module MarkupSafe >= 0.23}
BuildRequires: %{python_module pytest}
BuildRequires: %{python_module setuptools}
BuildRequires: dos2unix
BuildRequires: fdupes
BuildRequires: python-rpm-macros
Requires: python-Babel >= 0.8
@ -44,24 +43,13 @@ Obsoletes: %{oldpython}-jinja2 < %{version}
%description
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. 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 %%}
sandboxed environment.
%package -n python-Jinja2-vim
Summary: Jinja2 syntax files for Vim
License: BSD-3-Clause
Group: Productivity/Text/Editors
Requires: %{name} = %{version}
%if 0%{?suse_version} >= 1000 || 0%{?fedora_version} >= 24
%if 0%{?suse_version} || 0%{?fedora_version} >= 24
Recommends: vim
%endif
@ -71,9 +59,8 @@ Vim syntax highlighting scheme for Jinja2 templates.
%package -n python-Jinja2-emacs
Summary: Jinja2 syntax files for Emacs
License: GPL-2.0-or-later
Group: Productivity/Text/Editors
Requires: %{name} = %{version}
%if 0%{?suse_version} >= 1000 || 0%{?fedora_version} >= 24
%if 0%{?suse_version} || 0%{?fedora_version} >= 24
Recommends: emacs
%endif
@ -82,8 +69,7 @@ Emacs syntax highlighting scheme for Jinja2 templates.
%prep
%setup -q -n Jinja2-%{version}
%patch0 -p1
sed -i 's/\r$//' LICENSE # Fix wrong EOL encoding
dos2unix LICENSE.rst # Fix wrong EOL encoding
%build
%python_build
@ -98,8 +84,8 @@ install -Dm644 ext/jinja.el %{buildroot}%{_datadir}/emacs/site-lisp/jinja.el # I
%pytest
%files %{python_files}
%license LICENSE
%doc AUTHORS README.rst CHANGES.rst artwork examples
%license LICENSE.rst
%doc README.rst CHANGES.rst artwork examples
%{python_sitelib}/jinja2
%{python_sitelib}/Jinja2-%{version}-py%{python_version}.egg-info

View File

@ -1,187 +0,0 @@
From 31bf9b7e71c3fee3b7866ffdc0f70f4525a490d9 Mon Sep 17 00:00:00 2001
From: Florian Bruhin <git@the-compiler.org>
Date: Wed, 27 Jun 2018 15:30:54 +0200
Subject: [PATCH] Import abstract base classes from collections.abc
In Python 3.7, importing ABCs directly from the `collections` module shows a
warning (and in Python 3.8 it will stop working) - see
https://github.com/python/cpython/commit/c66f9f8d3909f588c251957d499599a1680e2320
This fixes various DeprecationWarnings such as those:
```
.../jinja2/utils.py:485: DeprecationWarning: Using or importing the ABCs from 'collections' instead of from 'collections.abc' is deprecated, and in 3.8 it will stop working
from collections import MutableMapping
.../jinja2/runtime.py:318: DeprecationWarning: Using or importing the ABCs from 'collections' instead of from 'collections.abc' is deprecated, and in 3.8 it will stop working
from collections import Mapping
```
---
docs/jinjaext.py | 4 ++--
jinja2/_compat.py | 6 ++++++
jinja2/runtime.py | 9 ++-------
jinja2/sandbox.py | 12 +++++-------
jinja2/tests.py | 5 ++---
jinja2/utils.py | 9 ++-------
6 files changed, 19 insertions(+), 26 deletions(-)
diff --git a/docs/jinjaext.py b/docs/jinjaext.py
index bb508089..fd38ee8f 100644
--- a/docs/jinjaext.py
+++ b/docs/jinjaext.py
@@ -8,7 +8,6 @@
:copyright: Copyright 2008 by Armin Ronacher.
:license: BSD.
"""
-import collections
import os
import re
import inspect
@@ -26,6 +25,7 @@
from pygments.token import Keyword, Name, Comment, String, Error, \
Number, Operator, Generic
from jinja2 import Environment, FileSystemLoader
+from jinja2._compat import abc
def parse_rst(state, content_offset, doc):
@@ -160,7 +160,7 @@ def walk(node, indent):
members = []
for key, name in node.__dict__.items():
if not key.startswith('_') and \
- not hasattr(node.__base__, key) and isinstance(name, collections.Callable):
+ not hasattr(node.__base__, key) and isinstance(name, abc.Callable):
members.append(key)
if members:
members.sort()
diff --git a/jinja2/_compat.py b/jinja2/_compat.py
index 61d85301..4dbf6ea0 100644
--- a/jinja2/_compat.py
+++ b/jinja2/_compat.py
@@ -97,3 +97,9 @@ def __new__(cls, name, this_bases, d):
from urllib.parse import quote_from_bytes as url_quote
except ImportError:
from urllib import quote as url_quote
+
+
+try:
+ from collections import abc
+except ImportError:
+ import collections as abc
diff --git a/jinja2/runtime.py b/jinja2/runtime.py
index f9d7a680..5e313369 100644
--- a/jinja2/runtime.py
+++ b/jinja2/runtime.py
@@ -20,7 +20,7 @@
TemplateNotFound
from jinja2._compat import imap, text_type, iteritems, \
implements_iterator, implements_to_string, string_types, PY2, \
- with_metaclass
+ with_metaclass, abc
# these variables are exported to the template runtime
@@ -313,12 +313,7 @@ def __repr__(self):
)
-# register the context as mapping if possible
-try:
- from collections import Mapping
- Mapping.register(Context)
-except ImportError:
- pass
+abc.Mapping.register(Context)
class BlockReference(object):
diff --git a/jinja2/sandbox.py b/jinja2/sandbox.py
index 03aaebd2..8015ee0c 100644
--- a/jinja2/sandbox.py
+++ b/jinja2/sandbox.py
@@ -14,10 +14,9 @@
"""
import types
import operator
-from collections import Mapping
from jinja2.environment import Environment
from jinja2.exceptions import SecurityError
-from jinja2._compat import string_types, PY2
+from jinja2._compat import string_types, PY2, abc
from jinja2.utils import Markup
from markupsafe import EscapeFormatter
@@ -79,10 +78,9 @@
pass
#: register Python 2.6 abstract base classes
-from collections import MutableSet, MutableMapping, MutableSequence
-_mutable_set_types += (MutableSet,)
-_mutable_mapping_types += (MutableMapping,)
-_mutable_sequence_types += (MutableSequence,)
+_mutable_set_types += (abc.MutableSet,)
+_mutable_mapping_types += (abc.MutableMapping,)
+_mutable_sequence_types += (abc.MutableSequence,)
_mutable_spec = (
@@ -103,7 +101,7 @@
)
-class _MagicFormatMapping(Mapping):
+class _MagicFormatMapping(abc.Mapping):
"""This class implements a dummy wrapper to fix a bug in the Python
standard library for string formatting.
diff --git a/jinja2/tests.py b/jinja2/tests.py
index 0adc3d4d..bc99d66c 100644
--- a/jinja2/tests.py
+++ b/jinja2/tests.py
@@ -10,9 +10,8 @@
"""
import operator
import re
-from collections import Mapping
from jinja2.runtime import Undefined
-from jinja2._compat import text_type, string_types, integer_types
+from jinja2._compat import text_type, string_types, integer_types, abc
import decimal
number_re = re.compile(r'^-?\d+(\.\d+)?$')
@@ -84,7 +83,7 @@ def test_mapping(value):
.. versionadded:: 2.6
"""
- return isinstance(value, Mapping)
+ return isinstance(value, abc.Mapping)
def test_number(value):
diff --git a/jinja2/utils.py b/jinja2/utils.py
index 083ea274..538b7745 100644
--- a/jinja2/utils.py
+++ b/jinja2/utils.py
@@ -14,7 +14,7 @@
from collections import deque
from threading import Lock
from jinja2._compat import text_type, string_types, implements_iterator, \
- url_quote
+ url_quote, abc
_word_split_re = re.compile(r'(\s+)')
@@ -480,12 +480,7 @@ def __reversed__(self):
__copy__ = copy
-# register the LRU cache as mutable mapping if possible
-try:
- from collections import MutableMapping
- MutableMapping.register(LRUCache)
-except ImportError:
- pass
+abc.MutableMapping.register(LRUCache)
def select_autoescape(enabled_extensions=('html', 'htm', 'xml'),