From 1535c3bd308728ffb9a0640d6a932c66bd85ae5f Mon Sep 17 00:00:00 2001 From: Thomas Moschny Date: Wed, 6 May 2020 08:54:00 +0200 Subject: [PATCH 01/53] Drop python2 subpackage from F33 on (#1832057). --- python-jinja2.spec | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/python-jinja2.spec b/python-jinja2.spec index fd2a6c1..ef9b0a9 100644 --- a/python-jinja2.spec +++ b/python-jinja2.spec @@ -2,7 +2,7 @@ Name: python-jinja2 Version: 2.11.2 -Release: 1%{?dist} +Release: 2%{?dist} Summary: General purpose template engine License: BSD URL: https://palletsprojects.com/p/jinja/ @@ -15,7 +15,7 @@ Source0: %{pypi_source} %bcond_with python3 %endif -%if 0%{?rhel} > 7 +%if 0%{?fedora} > 32 || 0%{?rhel} > 7 # Disable python2 build by default %bcond_with python2 %else @@ -180,6 +180,9 @@ PYTHONPATH=$(pwd)/src %{__python3} -m pytest tests %changelog +* Wed May 6 2020 Thomas Moschny - 2.11.2-2 +- Drop python2 subpackage from F33 on (#1832057). + * Wed Apr 15 2020 Thomas Moschny - 2.11.2-1 - Re-add dependency on python-setuptools. From 66365eda174aa0cf069e921a7491d5ff8dc56b05 Mon Sep 17 00:00:00 2001 From: Thomas Moschny Date: Fri, 22 May 2020 10:18:08 +0200 Subject: [PATCH 02/53] Revert "Drop python2 subpackage from F33 on (#1832057)." This reverts commit 1535c3bd308728ffb9a0640d6a932c66bd85ae5f. --- python-jinja2.spec | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/python-jinja2.spec b/python-jinja2.spec index ef9b0a9..fd2a6c1 100644 --- a/python-jinja2.spec +++ b/python-jinja2.spec @@ -2,7 +2,7 @@ Name: python-jinja2 Version: 2.11.2 -Release: 2%{?dist} +Release: 1%{?dist} Summary: General purpose template engine License: BSD URL: https://palletsprojects.com/p/jinja/ @@ -15,7 +15,7 @@ Source0: %{pypi_source} %bcond_with python3 %endif -%if 0%{?fedora} > 32 || 0%{?rhel} > 7 +%if 0%{?rhel} > 7 # Disable python2 build by default %bcond_with python2 %else @@ -180,9 +180,6 @@ PYTHONPATH=$(pwd)/src %{__python3} -m pytest tests %changelog -* Wed May 6 2020 Thomas Moschny - 2.11.2-2 -- Drop python2 subpackage from F33 on (#1832057). - * Wed Apr 15 2020 Thomas Moschny - 2.11.2-1 - Re-add dependency on python-setuptools. From 6aa957c8eff9b7c4a3f34d7c1a44cc045c816d8d Mon Sep 17 00:00:00 2001 From: Thomas Moschny Date: Fri, 22 May 2020 10:20:35 +0200 Subject: [PATCH 03/53] (Re-)Add changelog. --- python-jinja2.spec | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/python-jinja2.spec b/python-jinja2.spec index fd2a6c1..1f1f1e7 100644 --- a/python-jinja2.spec +++ b/python-jinja2.spec @@ -2,7 +2,7 @@ Name: python-jinja2 Version: 2.11.2 -Release: 1%{?dist} +Release: 3%{?dist} Summary: General purpose template engine License: BSD URL: https://palletsprojects.com/p/jinja/ @@ -180,6 +180,12 @@ PYTHONPATH=$(pwd)/src %{__python3} -m pytest tests %changelog +* Fri May 22 2020 Thomas Moschny - 2.11.2-3 +- Re-add python2 subpackage (#1832057). + +* Wed May 6 2020 Thomas Moschny - 2.11.2-2 +- Drop python2 subpackage from F33 on (#1832057). + * Wed Apr 15 2020 Thomas Moschny - 2.11.2-1 - Re-add dependency on python-setuptools. From 00956d349d867a278ef6be903e70dceec12a5b24 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Miro=20Hron=C4=8Dok?= Date: Fri, 22 May 2020 17:04:46 +0200 Subject: [PATCH 04/53] Bootstrap for Python 3.9 --- python-jinja2.spec | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/python-jinja2.spec b/python-jinja2.spec index 1f1f1e7..35bb896 100644 --- a/python-jinja2.spec +++ b/python-jinja2.spec @@ -1,8 +1,9 @@ +%global _without_docs 1 %global srcname Jinja2 Name: python-jinja2 Version: 2.11.2 -Release: 3%{?dist} +Release: 4%{?dist} Summary: General purpose template engine License: BSD URL: https://palletsprojects.com/p/jinja/ @@ -180,6 +181,9 @@ PYTHONPATH=$(pwd)/src %{__python3} -m pytest tests %changelog +* Fri May 22 2020 Miro Hrončok - 2.11.2-4 +- Bootstrap for Python 3.9 + * Fri May 22 2020 Thomas Moschny - 2.11.2-3 - Re-add python2 subpackage (#1832057). From 622b488116edf1f97e84f6af1af49f65022b2d92 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Miro=20Hron=C4=8Dok?= Date: Sun, 24 May 2020 10:05:24 +0200 Subject: [PATCH 05/53] Rebuilt for Python 3.9 --- python-jinja2.spec | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/python-jinja2.spec b/python-jinja2.spec index 35bb896..f8525c0 100644 --- a/python-jinja2.spec +++ b/python-jinja2.spec @@ -1,9 +1,8 @@ -%global _without_docs 1 %global srcname Jinja2 Name: python-jinja2 Version: 2.11.2 -Release: 4%{?dist} +Release: 5%{?dist} Summary: General purpose template engine License: BSD URL: https://palletsprojects.com/p/jinja/ @@ -181,6 +180,9 @@ PYTHONPATH=$(pwd)/src %{__python3} -m pytest tests %changelog +* Sun May 24 2020 Miro Hrončok - 2.11.2-5 +- Rebuilt for Python 3.9 + * Fri May 22 2020 Miro Hrončok - 2.11.2-4 - Bootstrap for Python 3.9 From 43a69b9aaf527ce47bc125416e8677989b29fd3c Mon Sep 17 00:00:00 2001 From: Fedora Release Engineering Date: Wed, 29 Jul 2020 01:42:23 +0000 Subject: [PATCH 06/53] - Rebuilt for https://fedoraproject.org/wiki/Fedora_33_Mass_Rebuild Signed-off-by: Fedora Release Engineering --- python-jinja2.spec | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/python-jinja2.spec b/python-jinja2.spec index f8525c0..17e2598 100644 --- a/python-jinja2.spec +++ b/python-jinja2.spec @@ -2,7 +2,7 @@ Name: python-jinja2 Version: 2.11.2 -Release: 5%{?dist} +Release: 6%{?dist} Summary: General purpose template engine License: BSD URL: https://palletsprojects.com/p/jinja/ @@ -180,6 +180,9 @@ PYTHONPATH=$(pwd)/src %{__python3} -m pytest tests %changelog +* Wed Jul 29 2020 Fedora Release Engineering - 2.11.2-6 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_33_Mass_Rebuild + * Sun May 24 2020 Miro Hrončok - 2.11.2-5 - Rebuilt for Python 3.9 From 3e72b873ffe7ae71f3da63f4a7715d67c9f6149b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Miro=20Hron=C4=8Dok?= Date: Mon, 21 Dec 2020 16:09:04 +0100 Subject: [PATCH 07/53] Drop python2-jinja2 on Fedora 34+ --- python-jinja2.spec | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/python-jinja2.spec b/python-jinja2.spec index 17e2598..b6a486a 100644 --- a/python-jinja2.spec +++ b/python-jinja2.spec @@ -2,7 +2,7 @@ Name: python-jinja2 Version: 2.11.2 -Release: 6%{?dist} +Release: 7%{?dist} Summary: General purpose template engine License: BSD URL: https://palletsprojects.com/p/jinja/ @@ -15,7 +15,7 @@ Source0: %{pypi_source} %bcond_with python3 %endif -%if 0%{?rhel} > 7 +%if 0%{?fedora} > 33 || 0%{?rhel} > 7 # Disable python2 build by default %bcond_with python2 %else @@ -180,6 +180,9 @@ PYTHONPATH=$(pwd)/src %{__python3} -m pytest tests %changelog +* Mon Dec 21 2020 Miro Hrončok - 2.11.2-7 +- Drop python2-jinja2 on Fedora 34+ + * Wed Jul 29 2020 Fedora Release Engineering - 2.11.2-6 - Rebuilt for https://fedoraproject.org/wiki/Fedora_33_Mass_Rebuild From 88ca56fd31c6e32c1123e0cfc48a9fae78fdc573 Mon Sep 17 00:00:00 2001 From: Fedora Release Engineering Date: Wed, 27 Jan 2021 11:17:33 +0000 Subject: [PATCH 08/53] - Rebuilt for https://fedoraproject.org/wiki/Fedora_34_Mass_Rebuild Signed-off-by: Fedora Release Engineering --- python-jinja2.spec | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/python-jinja2.spec b/python-jinja2.spec index b6a486a..5375b73 100644 --- a/python-jinja2.spec +++ b/python-jinja2.spec @@ -2,7 +2,7 @@ Name: python-jinja2 Version: 2.11.2 -Release: 7%{?dist} +Release: 8%{?dist} Summary: General purpose template engine License: BSD URL: https://palletsprojects.com/p/jinja/ @@ -180,6 +180,9 @@ PYTHONPATH=$(pwd)/src %{__python3} -m pytest tests %changelog +* Wed Jan 27 2021 Fedora Release Engineering - 2.11.2-8 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_34_Mass_Rebuild + * Mon Dec 21 2020 Miro Hrončok - 2.11.2-7 - Drop python2-jinja2 on Fedora 34+ From 93898ae45c1e90f2e9c41a49126884cb5be93ffc Mon Sep 17 00:00:00 2001 From: Thomas Moschny Date: Sat, 6 Feb 2021 14:00:59 +0100 Subject: [PATCH 09/53] Update to 2.11.3. Add patches to build with Python 3.10 (#1907442). --- ...-the-preserved-CodeType-attributes-1.patch | 27 ++++++++++ ...at-pass-only-strings-to-literal_eval.patch | 49 +++++++++++++++++++ python-jinja2.spec | 13 +++-- sources | 2 +- 4 files changed, 87 insertions(+), 4 deletions(-) create mode 100644 0001-add-linetable-to-the-preserved-CodeType-attributes-1.patch create mode 100644 0002-native_concat-pass-only-strings-to-literal_eval.patch diff --git a/0001-add-linetable-to-the-preserved-CodeType-attributes-1.patch b/0001-add-linetable-to-the-preserved-CodeType-attributes-1.patch new file mode 100644 index 0000000..7840d4f --- /dev/null +++ b/0001-add-linetable-to-the-preserved-CodeType-attributes-1.patch @@ -0,0 +1,27 @@ +From 9a99db929323f60553b391c80d0395821121d593 Mon Sep 17 00:00:00 2001 +From: Thomas Moschny +Date: Tue, 19 Jan 2021 21:01:18 +0100 +Subject: [PATCH] add 'linetable' to the preserved CodeType attributes (#1334) + +add 'linetable' to the preserved CodeType attributes + +co_linetable replaces co_lnotab as part of PEP 626 in Python 3.10. +--- + src/jinja2/debug.py | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/src/jinja2/debug.py b/src/jinja2/debug.py +index 5d8aec3..e256617 100644 +--- a/src/jinja2/debug.py ++++ b/src/jinja2/debug.py +@@ -137,6 +137,7 @@ def fake_traceback(exc_value, tb, filename, lineno): + "lnotab", + "freevars", + "cellvars", ++ "linetable", # Python 3.10 + ): + if isinstance(attr, tuple): + # Replace with given value. +-- +2.29.2 + diff --git a/0002-native_concat-pass-only-strings-to-literal_eval.patch b/0002-native_concat-pass-only-strings-to-literal_eval.patch new file mode 100644 index 0000000..3e0e76a --- /dev/null +++ b/0002-native_concat-pass-only-strings-to-literal_eval.patch @@ -0,0 +1,49 @@ +From 58250a709532ccb3e6d92ca65b3d305d1464cb68 Mon Sep 17 00:00:00 2001 +From: Martin Krizek +Date: Thu, 28 Jan 2021 10:08:50 +0100 +Subject: [PATCH] native_concat: pass only strings to literal_eval + +If there is only single node and it is not a string, there is no point +in passing it into ``literal_eval``, just return it immediately. + +One of the examples where passing a non-string node into +``literal_eval`` would actually cause problems is when the node is +``Undefined``. On Python 3.10 this would cause ``UndefinedError`` +instead of just ``Undefined`` being returned. + +Fixes #1335 +--- + CHANGES.rst | 3 +++ + src/jinja2/nativetypes.py | 2 ++ + 2 files changed, 5 insertions(+) + +diff --git a/CHANGES.rst b/CHANGES.rst +index 511b22b..a8a66ea 100644 +--- a/CHANGES.rst ++++ b/CHANGES.rst +@@ -8,6 +8,9 @@ Released 2021-01-31 + - Improve the speed of the ``urlize`` filter by reducing regex + backtracking. Email matching requires a word character at the start + of the domain part, and only word characters in the TLD. :pr:`1343` ++- Fix UndefinedError incorrectly being thrown on an undefined variable ++ instead of ``Undefined`` being returned on ++ ``NativeEnvironment`` on Python 3.10. :issue:`1335` + + + Version 2.11.2 +diff --git a/src/jinja2/nativetypes.py b/src/jinja2/nativetypes.py +index a9ead4e..2fee17f 100644 +--- a/src/jinja2/nativetypes.py ++++ b/src/jinja2/nativetypes.py +@@ -26,6 +26,8 @@ def native_concat(nodes): + + if len(head) == 1: + raw = head[0] ++ if not isinstance(raw, str): ++ return raw + else: + raw = u"".join([text_type(v) for v in chain(head, nodes)]) + +-- +2.29.2 + diff --git a/python-jinja2.spec b/python-jinja2.spec index 5375b73..3cb3a79 100644 --- a/python-jinja2.spec +++ b/python-jinja2.spec @@ -1,12 +1,15 @@ %global srcname Jinja2 Name: python-jinja2 -Version: 2.11.2 -Release: 8%{?dist} +Version: 2.11.3 +Release: 1%{?dist} Summary: General purpose template engine License: BSD URL: https://palletsprojects.com/p/jinja/ Source0: %{pypi_source} +# cherry-picked patches to build with Python 3.10 (#1907442) +Patch1: 0001-add-linetable-to-the-preserved-CodeType-attributes-1.patch +Patch2: 0002-native_concat-pass-only-strings-to-literal_eval.patch %if 0%{?fedora} || 0%{?rhel} > 7 # Enable python3 build by default @@ -105,7 +108,7 @@ environments. %prep -%autosetup -n %{srcname}-%{version} +%autosetup -p1 -n %{srcname}-%{version} # cleanup find . -name '*.pyo' -o -name '*.pyc' -delete @@ -180,6 +183,10 @@ PYTHONPATH=$(pwd)/src %{__python3} -m pytest tests %changelog +* Sat Feb 6 2021 Thomas Moschny - 2.11.3-1 +- Update to 2.11.3. +- Add patches to build with Python 3.10 (#1907442). + * Wed Jan 27 2021 Fedora Release Engineering - 2.11.2-8 - Rebuilt for https://fedoraproject.org/wiki/Fedora_34_Mass_Rebuild diff --git a/sources b/sources index 1a05893..a742c89 100644 --- a/sources +++ b/sources @@ -1 +1 @@ -SHA512 (Jinja2-2.11.2.tar.gz) = baf62118702a7e113e6a22d9af58a5fa66af8017ded08f18705107a4cb93c9727c7fa118436aadfe0729d7f496241ca7bcce27863c5b19deaee3852eda68c082 +SHA512 (Jinja2-2.11.3.tar.gz) = fce4f835795fe9afb622f8106f60344032a811f3f693806f31ba482f9b7c1400f93dfa1701b4db0b472cbed4b0793cb329778c8091811ef0e3b577150d28e004 From 78e96aac1d4e340245f5daf410114addc4f62373 Mon Sep 17 00:00:00 2001 From: Thomas Moschny Date: Sat, 6 Feb 2021 14:11:59 +0100 Subject: [PATCH 10/53] Update to 2.11.3. --- python-jinja2.spec | 5 ++++- sources | 2 +- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/python-jinja2.spec b/python-jinja2.spec index fd2a6c1..e1c4567 100644 --- a/python-jinja2.spec +++ b/python-jinja2.spec @@ -1,7 +1,7 @@ %global srcname Jinja2 Name: python-jinja2 -Version: 2.11.2 +Version: 2.11.3 Release: 1%{?dist} Summary: General purpose template engine License: BSD @@ -180,6 +180,9 @@ PYTHONPATH=$(pwd)/src %{__python3} -m pytest tests %changelog +* Sat Feb 6 2021 Thomas Moschny - 2.11.3-1 +- Update to 2.11.3. + * Wed Apr 15 2020 Thomas Moschny - 2.11.2-1 - Re-add dependency on python-setuptools. diff --git a/sources b/sources index 1a05893..a742c89 100644 --- a/sources +++ b/sources @@ -1 +1 @@ -SHA512 (Jinja2-2.11.2.tar.gz) = baf62118702a7e113e6a22d9af58a5fa66af8017ded08f18705107a4cb93c9727c7fa118436aadfe0729d7f496241ca7bcce27863c5b19deaee3852eda68c082 +SHA512 (Jinja2-2.11.3.tar.gz) = fce4f835795fe9afb622f8106f60344032a811f3f693806f31ba482f9b7c1400f93dfa1701b4db0b472cbed4b0793cb329778c8091811ef0e3b577150d28e004 From 94e6de8860de51f71a30bdae3439a8b93b62bcd3 Mon Sep 17 00:00:00 2001 From: Python Maint Date: Wed, 2 Jun 2021 17:31:07 +0200 Subject: [PATCH 11/53] Bootstrap for Python 3.10 --- python-jinja2.spec | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/python-jinja2.spec b/python-jinja2.spec index 3cb3a79..0826c13 100644 --- a/python-jinja2.spec +++ b/python-jinja2.spec @@ -1,8 +1,9 @@ +%global _without_docs 1 %global srcname Jinja2 Name: python-jinja2 Version: 2.11.3 -Release: 1%{?dist} +Release: 2%{?dist} Summary: General purpose template engine License: BSD URL: https://palletsprojects.com/p/jinja/ @@ -183,6 +184,9 @@ PYTHONPATH=$(pwd)/src %{__python3} -m pytest tests %changelog +* Wed Jun 02 2021 Python Maint - 2.11.3-2 +- Bootstrap for Python 3.10 + * Sat Feb 6 2021 Thomas Moschny - 2.11.3-1 - Update to 2.11.3. - Add patches to build with Python 3.10 (#1907442). From 6be37c33e6030eb62be9e90a7208e00f8167c194 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Miro=20Hron=C4=8Dok?= Date: Wed, 2 Jun 2021 18:04:00 +0200 Subject: [PATCH 12/53] Temporarily ignore DeprecationWarning in get_event_loop() in tests --- 0003-ignore-get_event_loop-DeprecationWarning.patch | 12 ++++++++++++ python-jinja2.spec | 2 ++ 2 files changed, 14 insertions(+) create mode 100644 0003-ignore-get_event_loop-DeprecationWarning.patch diff --git a/0003-ignore-get_event_loop-DeprecationWarning.patch b/0003-ignore-get_event_loop-DeprecationWarning.patch new file mode 100644 index 0000000..f8586ed --- /dev/null +++ b/0003-ignore-get_event_loop-DeprecationWarning.patch @@ -0,0 +1,12 @@ +diff --git a/setup.cfg b/setup.cfg +index 3387720..fa69df8 100644 +--- a/setup.cfg ++++ b/setup.cfg +@@ -10,6 +10,7 @@ testpaths = tests + filterwarnings = + error + ignore:the sets module:DeprecationWarning:jinja2.sandbox ++ ignore:There is no current event loop:DeprecationWarning + + [coverage:run] + branch = True diff --git a/python-jinja2.spec b/python-jinja2.spec index 0826c13..22ef28e 100644 --- a/python-jinja2.spec +++ b/python-jinja2.spec @@ -11,6 +11,8 @@ Source0: %{pypi_source} # cherry-picked patches to build with Python 3.10 (#1907442) Patch1: 0001-add-linetable-to-the-preserved-CodeType-attributes-1.patch Patch2: 0002-native_concat-pass-only-strings-to-literal_eval.patch +# temporarily ignore DeprecationWarning in get_event_loop() in tests +Patch3: 0003-ignore-get_event_loop-DeprecationWarning.patch %if 0%{?fedora} || 0%{?rhel} > 7 # Enable python3 build by default From eb8d02cae6d7afeb48512a1f05a99ef7e3306095 Mon Sep 17 00:00:00 2001 From: Python Maint Date: Fri, 4 Jun 2021 10:16:10 +0200 Subject: [PATCH 13/53] Rebuilt for Python 3.10 --- python-jinja2.spec | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/python-jinja2.spec b/python-jinja2.spec index 22ef28e..cf9da7c 100644 --- a/python-jinja2.spec +++ b/python-jinja2.spec @@ -1,9 +1,8 @@ -%global _without_docs 1 %global srcname Jinja2 Name: python-jinja2 Version: 2.11.3 -Release: 2%{?dist} +Release: 3%{?dist} Summary: General purpose template engine License: BSD URL: https://palletsprojects.com/p/jinja/ @@ -186,6 +185,9 @@ PYTHONPATH=$(pwd)/src %{__python3} -m pytest tests %changelog +* Fri Jun 04 2021 Python Maint - 2.11.3-3 +- Rebuilt for Python 3.10 + * Wed Jun 02 2021 Python Maint - 2.11.3-2 - Bootstrap for Python 3.10 From 81f300b434ec3e8031b5520deb56d16f76150ecb Mon Sep 17 00:00:00 2001 From: Lumir Balhar Date: Tue, 22 Jun 2021 23:03:10 +0200 Subject: [PATCH 14/53] Update to 3.0.1 --- ...-the-preserved-CodeType-attributes-1.patch | 27 ---------- ...at-pass-only-strings-to-literal_eval.patch | 49 ------------------- ...re-get_event_loop-DeprecationWarning.patch | 12 ----- python-jinja2.spec | 14 +++--- sources | 2 +- 5 files changed, 7 insertions(+), 97 deletions(-) delete mode 100644 0001-add-linetable-to-the-preserved-CodeType-attributes-1.patch delete mode 100644 0002-native_concat-pass-only-strings-to-literal_eval.patch delete mode 100644 0003-ignore-get_event_loop-DeprecationWarning.patch diff --git a/0001-add-linetable-to-the-preserved-CodeType-attributes-1.patch b/0001-add-linetable-to-the-preserved-CodeType-attributes-1.patch deleted file mode 100644 index 7840d4f..0000000 --- a/0001-add-linetable-to-the-preserved-CodeType-attributes-1.patch +++ /dev/null @@ -1,27 +0,0 @@ -From 9a99db929323f60553b391c80d0395821121d593 Mon Sep 17 00:00:00 2001 -From: Thomas Moschny -Date: Tue, 19 Jan 2021 21:01:18 +0100 -Subject: [PATCH] add 'linetable' to the preserved CodeType attributes (#1334) - -add 'linetable' to the preserved CodeType attributes - -co_linetable replaces co_lnotab as part of PEP 626 in Python 3.10. ---- - src/jinja2/debug.py | 1 + - 1 file changed, 1 insertion(+) - -diff --git a/src/jinja2/debug.py b/src/jinja2/debug.py -index 5d8aec3..e256617 100644 ---- a/src/jinja2/debug.py -+++ b/src/jinja2/debug.py -@@ -137,6 +137,7 @@ def fake_traceback(exc_value, tb, filename, lineno): - "lnotab", - "freevars", - "cellvars", -+ "linetable", # Python 3.10 - ): - if isinstance(attr, tuple): - # Replace with given value. --- -2.29.2 - diff --git a/0002-native_concat-pass-only-strings-to-literal_eval.patch b/0002-native_concat-pass-only-strings-to-literal_eval.patch deleted file mode 100644 index 3e0e76a..0000000 --- a/0002-native_concat-pass-only-strings-to-literal_eval.patch +++ /dev/null @@ -1,49 +0,0 @@ -From 58250a709532ccb3e6d92ca65b3d305d1464cb68 Mon Sep 17 00:00:00 2001 -From: Martin Krizek -Date: Thu, 28 Jan 2021 10:08:50 +0100 -Subject: [PATCH] native_concat: pass only strings to literal_eval - -If there is only single node and it is not a string, there is no point -in passing it into ``literal_eval``, just return it immediately. - -One of the examples where passing a non-string node into -``literal_eval`` would actually cause problems is when the node is -``Undefined``. On Python 3.10 this would cause ``UndefinedError`` -instead of just ``Undefined`` being returned. - -Fixes #1335 ---- - CHANGES.rst | 3 +++ - src/jinja2/nativetypes.py | 2 ++ - 2 files changed, 5 insertions(+) - -diff --git a/CHANGES.rst b/CHANGES.rst -index 511b22b..a8a66ea 100644 ---- a/CHANGES.rst -+++ b/CHANGES.rst -@@ -8,6 +8,9 @@ Released 2021-01-31 - - Improve the speed of the ``urlize`` filter by reducing regex - backtracking. Email matching requires a word character at the start - of the domain part, and only word characters in the TLD. :pr:`1343` -+- Fix UndefinedError incorrectly being thrown on an undefined variable -+ instead of ``Undefined`` being returned on -+ ``NativeEnvironment`` on Python 3.10. :issue:`1335` - - - Version 2.11.2 -diff --git a/src/jinja2/nativetypes.py b/src/jinja2/nativetypes.py -index a9ead4e..2fee17f 100644 ---- a/src/jinja2/nativetypes.py -+++ b/src/jinja2/nativetypes.py -@@ -26,6 +26,8 @@ def native_concat(nodes): - - if len(head) == 1: - raw = head[0] -+ if not isinstance(raw, str): -+ return raw - else: - raw = u"".join([text_type(v) for v in chain(head, nodes)]) - --- -2.29.2 - diff --git a/0003-ignore-get_event_loop-DeprecationWarning.patch b/0003-ignore-get_event_loop-DeprecationWarning.patch deleted file mode 100644 index f8586ed..0000000 --- a/0003-ignore-get_event_loop-DeprecationWarning.patch +++ /dev/null @@ -1,12 +0,0 @@ -diff --git a/setup.cfg b/setup.cfg -index 3387720..fa69df8 100644 ---- a/setup.cfg -+++ b/setup.cfg -@@ -10,6 +10,7 @@ testpaths = tests - filterwarnings = - error - ignore:the sets module:DeprecationWarning:jinja2.sandbox -+ ignore:There is no current event loop:DeprecationWarning - - [coverage:run] - branch = True diff --git a/python-jinja2.spec b/python-jinja2.spec index cf9da7c..1133f78 100644 --- a/python-jinja2.spec +++ b/python-jinja2.spec @@ -1,17 +1,12 @@ %global srcname Jinja2 Name: python-jinja2 -Version: 2.11.3 -Release: 3%{?dist} +Version: 3.0.1 +Release: 1%{?dist} Summary: General purpose template engine License: BSD URL: https://palletsprojects.com/p/jinja/ Source0: %{pypi_source} -# cherry-picked patches to build with Python 3.10 (#1907442) -Patch1: 0001-add-linetable-to-the-preserved-CodeType-attributes-1.patch -Patch2: 0002-native_concat-pass-only-strings-to-literal_eval.patch -# temporarily ignore DeprecationWarning in get_event_loop() in tests -Patch3: 0003-ignore-get_event_loop-DeprecationWarning.patch %if 0%{?fedora} || 0%{?rhel} > 7 # Enable python3 build by default @@ -173,7 +168,6 @@ PYTHONPATH=$(pwd)/src %{__python3} -m pytest tests %if %{with python3} %files -n python3-jinja2 %doc CHANGES.rst -%doc ext %doc examples %license LICENSE.rst %if %{with docs} @@ -185,6 +179,10 @@ PYTHONPATH=$(pwd)/src %{__python3} -m pytest tests %changelog +* Tue Jun 22 2021 Lumír Balhar - 3.0.1-1 +- Update to 3.0.1 +- Resolves: rhbz#1961862 + * Fri Jun 04 2021 Python Maint - 2.11.3-3 - Rebuilt for Python 3.10 diff --git a/sources b/sources index a742c89..166072d 100644 --- a/sources +++ b/sources @@ -1 +1 @@ -SHA512 (Jinja2-2.11.3.tar.gz) = fce4f835795fe9afb622f8106f60344032a811f3f693806f31ba482f9b7c1400f93dfa1701b4db0b472cbed4b0793cb329778c8091811ef0e3b577150d28e004 +SHA512 (Jinja2-3.0.1.tar.gz) = 18ca56fb2271885c41982d2a3b2daa8bdc7a95191f54d8eec96ddbe001ac995b3fae766b603d8c9287413e5227062b771575012cd92a3f64ed76067d5f168701 From 5fea5530818c17c54c6ed03f82794f8950f32591 Mon Sep 17 00:00:00 2001 From: Fedora Release Engineering Date: Fri, 23 Jul 2021 07:01:44 +0000 Subject: [PATCH 15/53] - Rebuilt for https://fedoraproject.org/wiki/Fedora_35_Mass_Rebuild Signed-off-by: Fedora Release Engineering --- python-jinja2.spec | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/python-jinja2.spec b/python-jinja2.spec index 1133f78..4b68047 100644 --- a/python-jinja2.spec +++ b/python-jinja2.spec @@ -2,7 +2,7 @@ Name: python-jinja2 Version: 3.0.1 -Release: 1%{?dist} +Release: 2%{?dist} Summary: General purpose template engine License: BSD URL: https://palletsprojects.com/p/jinja/ @@ -179,6 +179,9 @@ PYTHONPATH=$(pwd)/src %{__python3} -m pytest tests %changelog +* Fri Jul 23 2021 Fedora Release Engineering - 3.0.1-2 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_35_Mass_Rebuild + * Tue Jun 22 2021 Lumír Balhar - 3.0.1-1 - Update to 3.0.1 - Resolves: rhbz#1961862 From f7a716750bd4b8d36e2f94d98c4e03b6c8befc7a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Miro=20Hron=C4=8Dok?= Date: Thu, 4 Nov 2021 18:18:44 +0100 Subject: [PATCH 16/53] Fix build with Python 3.11.0a1 --- 1525.patch | 33 +++++++++++++++++++++++++++ 1527.patch | 56 ++++++++++++++++++++++++++++++++++++++++++++++ python-jinja2.spec | 5 +++++ 3 files changed, 94 insertions(+) create mode 100644 1525.patch create mode 100644 1527.patch diff --git a/1525.patch b/1525.patch new file mode 100644 index 0000000..1528f23 --- /dev/null +++ b/1525.patch @@ -0,0 +1,33 @@ +From e32c985af3a419ae2ea0853ad8084a12ab62745b Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Miro=20Hron=C4=8Dok?= +Date: Tue, 2 Nov 2021 16:47:28 +0100 +Subject: [PATCH] Tests: Make "Traceback did not match" an actual f-string + +Otherwise the failure looks like this: + + > assert ( + m is not None + ), "Traceback did not match:\n\n{''.join(tb)}\nexpected:\n{expected_tb}" + E AssertionError: Traceback did not match: + E + E {''.join(tb)} + E expected: + E {expected_tb} + E assert None is not None +--- + tests/test_debug.py | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/tests/test_debug.py b/tests/test_debug.py +index 0aec78ae4..c639bbc29 100644 +--- a/tests/test_debug.py ++++ b/tests/test_debug.py +@@ -25,7 +25,7 @@ def assert_traceback_matches(self, callback, expected_tb): + m = re.search(expected_tb.strip(), "".join(tb)) + assert ( + m is not None +- ), "Traceback did not match:\n\n{''.join(tb)}\nexpected:\n{expected_tb}" ++ ), f"Traceback did not match:\n\n{''.join(tb)}\nexpected:\n{expected_tb}" + + def test_runtime_error(self, fs_env): + def test(): diff --git a/1527.patch b/1527.patch new file mode 100644 index 0000000..e5b0b2b --- /dev/null +++ b/1527.patch @@ -0,0 +1,56 @@ +From 757756696ceebf9967ad8b8c6df60a2be7f23c51 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Miro=20Hron=C4=8Dok?= +Date: Thu, 4 Nov 2021 18:03:06 +0100 +Subject: [PATCH] Tests: Adapt expected traceback regexes for Python 3.11.0a1 + +Fixes https://github.com/pallets/jinja/issues/1526 + +Before: + + File ".../broken.html", line 2, in + {{ fail() }} + File ".../test_debug.py", line 32, in + tmpl.render(fail=lambda: 1 / 0) + ZeroDivisionError: division by zero + +After: + + File ".../broken.html", line 2, in + {{ fail() }} + ^^^^^^^^^^^^ + File ".../test_debug.py", line 32, in + tmpl.render(fail=lambda: 1 / 0) + ~~^~~ + ZeroDivisionError: division by zero +--- + tests/test_debug.py | 9 ++++++--- + 1 file changed, 6 insertions(+), 3 deletions(-) + +diff --git a/tests/test_debug.py b/tests/test_debug.py +index 0aec78ae4..1cb931cfc 100644 +--- a/tests/test_debug.py ++++ b/tests/test_debug.py +@@ -36,9 +36,11 @@ def test(): + test, + r""" + File ".*?broken.html", line 2, in (top-level template code|) +- \{\{ fail\(\) \}\} ++ \{\{ fail\(\) \}\}( ++ \^{12})? + File ".*debug?.pyc?", line \d+, in +- tmpl\.render\(fail=lambda: 1 / 0\) ++ tmpl\.render\(fail=lambda: 1 / 0\)( ++ ~~\^~~)? + ZeroDivisionError: (int(eger)? )?division (or modulo )?by zero + """, + ) +@@ -66,7 +68,8 @@ def test(): + test, + r""" + File ".*debug.pyc?", line \d+, in test +- raise TemplateSyntaxError\("wtf", 42\) ++ raise TemplateSyntaxError\("wtf", 42\)( ++ \^{36})? + (jinja2\.exceptions\.)?TemplateSyntaxError: wtf + line 42""", + ) diff --git a/python-jinja2.spec b/python-jinja2.spec index 4b68047..01afdbf 100644 --- a/python-jinja2.spec +++ b/python-jinja2.spec @@ -8,6 +8,11 @@ License: BSD URL: https://palletsprojects.com/p/jinja/ Source0: %{pypi_source} +# Tests: Make "Traceback did not match" an actual f-string +Patch1: https://github.com/pallets/jinja/pull/1525.patch +# Tests: Adapt expected traceback regexes for Python 3.11.0a1 +Patch2: https://github.com/pallets/jinja/pull/1527.patch + %if 0%{?fedora} || 0%{?rhel} > 7 # Enable python3 build by default %bcond_without python3 From 6f194bb41bfde389436798f9b64ca8f49ceeb9d0 Mon Sep 17 00:00:00 2001 From: Karolina Surma Date: Wed, 10 Nov 2021 09:38:20 +0100 Subject: [PATCH 17/53] Declare i18n extra to map the upstream package structure Stop requiring the explicit runtime dependencies when building with Python 3. They're read from metadata. --- python-jinja2.spec | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/python-jinja2.spec b/python-jinja2.spec index 01afdbf..2c5b330 100644 --- a/python-jinja2.spec +++ b/python-jinja2.spec @@ -2,7 +2,7 @@ Name: python-jinja2 Version: 3.0.1 -Release: 2%{?dist} +Release: 3%{?dist} Summary: General purpose template engine License: BSD URL: https://palletsprojects.com/p/jinja/ @@ -91,10 +91,6 @@ BuildRequires: python3-Pallets-Sphinx-Themes BuildRequires: python3-sphinxcontrib-log-cabinet BuildRequires: python3-sphinx-issues %endif -Requires: python3-babel >= 0.8 -Requires: python3-markupsafe >= 0.23 -Requires: python3-setuptools -%{?python_provide:%python_provide python3-jinja2} %description -n python3-jinja2 Jinja2 is a template engine written in pure Python. It provides a @@ -106,6 +102,8 @@ as Smarty or Django, you should feel right at home with Jinja2. It's both designer and developer friendly by sticking to Python's principles and adding functionality useful for templating environments. + +%{?python_extras_subpkg:%python_extras_subpkg -n python3-jinja2 -i%{python3_sitelib}/Jinja2-*.egg-info i18n} %endif # with python3 @@ -184,6 +182,10 @@ PYTHONPATH=$(pwd)/src %{__python3} -m pytest tests %changelog +* Wed Nov 10 2021 Karolina Surma - 3.0.1-3 +- Don't explicitly declare runtime dependencies when building for Python 3 +- Declare jinja2+i18n extra to map the upstream package structure + * Fri Jul 23 2021 Fedora Release Engineering - 3.0.1-2 - Rebuilt for https://fedoraproject.org/wiki/Fedora_35_Mass_Rebuild From 652a40287ba43d4c3d03bb642927986a5f6191c0 Mon Sep 17 00:00:00 2001 From: Thomas Moschny Date: Mon, 15 Nov 2021 21:11:41 +0100 Subject: [PATCH 18/53] Use new Python packaging guidelines. Jinja2 version 3 does not support Python 2 anymore. --- python-jinja2.spec | 140 ++++++++------------------------------------- 1 file changed, 23 insertions(+), 117 deletions(-) diff --git a/python-jinja2.spec b/python-jinja2.spec index 2c5b330..cbb6c8a 100644 --- a/python-jinja2.spec +++ b/python-jinja2.spec @@ -2,7 +2,7 @@ Name: python-jinja2 Version: 3.0.1 -Release: 3%{?dist} +Release: 4%{?dist} Summary: General purpose template engine License: BSD URL: https://palletsprojects.com/p/jinja/ @@ -13,34 +13,14 @@ Patch1: https://github.com/pallets/jinja/pull/1525.patch # Tests: Adapt expected traceback regexes for Python 3.11.0a1 Patch2: https://github.com/pallets/jinja/pull/1527.patch -%if 0%{?fedora} || 0%{?rhel} > 7 -# Enable python3 build by default -%bcond_without python3 -%else -%bcond_with python3 -%endif - -%if 0%{?fedora} > 33 || 0%{?rhel} > 7 -# Disable python2 build by default -%bcond_with python2 -%else -%bcond_without python2 -%endif - # Enable building without docs to avoid a circular dependency between this # and python-sphinx: %bcond_without docs -%if 0%{?fedora} || 0%{?rhel} > 7 -%bcond_without async -%else -%bcond_with async -%endif - BuildArch: noarch -%description -Jinja2 is a template engine written in pure Python. It provides a +%global _description %{expand: +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. @@ -48,42 +28,13 @@ If you have any exposure to other text-based template languages, such as Smarty or Django, you should feel right at home with Jinja2. It's both designer and developer friendly by sticking to Python's principles and adding functionality useful for templating -environments. +environments.} +%description %_description -%if %{with python2} -%package -n python2-jinja2 -Summary: General purpose template engine for python2 -BuildRequires: python2-devel -BuildRequires: python2-setuptools -BuildRequires: python2-babel >= 0.8 -BuildRequires: python2-markupsafe >= 0.23 -Requires: python2-babel >= 0.8 -Requires: python2-markupsafe >= 0.23 -Requires: python2-setuptools -%{?python_provide:%python_provide python2-jinja2} - -%description -n python2-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. - -If you have any exposure to other text-based template languages, such -as Smarty or Django, you should feel right at home with Jinja2. It's -both designer and developer friendly by sticking to Python's -principles and adding functionality useful for templating -environments. -%endif # with python2 - - -%if %{with python3} %package -n python3-jinja2 -Summary: General purpose template engine for python3 +Summary: %{summary} BuildRequires: python3-devel -BuildRequires: python3-setuptools -BuildRequires: python3-babel >= 0.8 -BuildRequires: python3-markupsafe >= 0.23 -BuildRequires: python3-pytest %if %{with docs} BuildRequires: %{_bindir}/sphinx-build-3 BuildRequires: make @@ -92,96 +43,51 @@ BuildRequires: python3-sphinxcontrib-log-cabinet BuildRequires: python3-sphinx-issues %endif -%description -n python3-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. +%description -n python3-jinja2 %_description -If you have any exposure to other text-based template languages, such -as Smarty or Django, you should feel right at home with Jinja2. It's -both designer and developer friendly by sticking to Python's -principles and adding functionality useful for templating -environments. - -%{?python_extras_subpkg:%python_extras_subpkg -n python3-jinja2 -i%{python3_sitelib}/Jinja2-*.egg-info i18n} -%endif # with python3 +%pyproject_extras_subpkg -n python3-jinja2 i18n %prep %autosetup -p1 -n %{srcname}-%{version} -# cleanup -find . -name '*.pyo' -o -name '*.pyc' -delete + +%generate_buildrequires +%pyproject_buildrequires -x i18n + %build -%if %{with python2} -%py2_build -%endif # with python2 - -%if %{with python3} -%py3_build +%pyproject_wheel %if %{with docs} make -C docs html PYTHONPATH=$(pwd)/src SPHINXBUILD=sphinx-build-3 # remove hidden file -rm -rf docs/_build/html/.buildinfo -%endif # with docs -%endif # with python3 +rm -rvf docs/_build/html/.buildinfo +%endif %install -%if %{with python2} -%py2_install - -# these files are valid only on Python 3.6+ -rm %{buildroot}%{python2_sitelib}/jinja2/asyncsupport.py -rm %{buildroot}%{python2_sitelib}/jinja2/asyncfilters.py -%endif # with python2 - -%if %{with python3} -%py3_install - -%if ! %{with async} -# these files are valid only on Python 3.6+ -rm %{buildroot}%{python3_sitelib}/jinja2/asyncsupport.py -rm %{buildroot}%{python3_sitelib}/jinja2/asyncfilters.py -%endif # ! with async -%endif # with python3 +%pyproject_install +%pyproject_save_files jinja2 %check -%if %{with python3} -PYTHONPATH=$(pwd)/src %{__python3} -m pytest tests -%endif # with python3 +%pytest tests -%if %{with python2} -%files -n python2-jinja2 -%doc CHANGES.rst -%doc ext -%doc examples -%license LICENSE.rst -%if %{with docs} -%doc docs/_build/html -%endif -%{python2_sitelib}/jinja2/ -%{python2_sitelib}/Jinja2-*.egg-info/ -%endif # with python2 - - -%if %{with python3} -%files -n python3-jinja2 +%files -n python3-jinja2 -f %{pyproject_files} %doc CHANGES.rst %doc examples %license LICENSE.rst %if %{with docs} %doc docs/_build/html %endif -%{python3_sitelib}/jinja2/ -%{python3_sitelib}/Jinja2-*.egg-info/ -%endif # with python3 %changelog +* Mon Nov 15 2021 Thomas Moschny - 3.0.1-4 +- Use new Python packaging guidelines. +- Jinja2 version 3 does not support Python 2 anymore. + * Wed Nov 10 2021 Karolina Surma - 3.0.1-3 - Don't explicitly declare runtime dependencies when building for Python 3 - Declare jinja2+i18n extra to map the upstream package structure From b498647db83ea5dd01d9af70e10a135e0eca4ca5 Mon Sep 17 00:00:00 2001 From: Thomas Moschny Date: Mon, 15 Nov 2021 21:25:57 +0100 Subject: [PATCH 19/53] Update to 3.0.3. --- 1527.patch | 56 ---------------------------------------------- python-jinja2.spec | 11 ++++----- sources | 2 +- 3 files changed, 7 insertions(+), 62 deletions(-) delete mode 100644 1527.patch diff --git a/1527.patch b/1527.patch deleted file mode 100644 index e5b0b2b..0000000 --- a/1527.patch +++ /dev/null @@ -1,56 +0,0 @@ -From 757756696ceebf9967ad8b8c6df60a2be7f23c51 Mon Sep 17 00:00:00 2001 -From: =?UTF-8?q?Miro=20Hron=C4=8Dok?= -Date: Thu, 4 Nov 2021 18:03:06 +0100 -Subject: [PATCH] Tests: Adapt expected traceback regexes for Python 3.11.0a1 - -Fixes https://github.com/pallets/jinja/issues/1526 - -Before: - - File ".../broken.html", line 2, in - {{ fail() }} - File ".../test_debug.py", line 32, in - tmpl.render(fail=lambda: 1 / 0) - ZeroDivisionError: division by zero - -After: - - File ".../broken.html", line 2, in - {{ fail() }} - ^^^^^^^^^^^^ - File ".../test_debug.py", line 32, in - tmpl.render(fail=lambda: 1 / 0) - ~~^~~ - ZeroDivisionError: division by zero ---- - tests/test_debug.py | 9 ++++++--- - 1 file changed, 6 insertions(+), 3 deletions(-) - -diff --git a/tests/test_debug.py b/tests/test_debug.py -index 0aec78ae4..1cb931cfc 100644 ---- a/tests/test_debug.py -+++ b/tests/test_debug.py -@@ -36,9 +36,11 @@ def test(): - test, - r""" - File ".*?broken.html", line 2, in (top-level template code|) -- \{\{ fail\(\) \}\} -+ \{\{ fail\(\) \}\}( -+ \^{12})? - File ".*debug?.pyc?", line \d+, in -- tmpl\.render\(fail=lambda: 1 / 0\) -+ tmpl\.render\(fail=lambda: 1 / 0\)( -+ ~~\^~~)? - ZeroDivisionError: (int(eger)? )?division (or modulo )?by zero - """, - ) -@@ -66,7 +68,8 @@ def test(): - test, - r""" - File ".*debug.pyc?", line \d+, in test -- raise TemplateSyntaxError\("wtf", 42\) -+ raise TemplateSyntaxError\("wtf", 42\)( -+ \^{36})? - (jinja2\.exceptions\.)?TemplateSyntaxError: wtf - line 42""", - ) diff --git a/python-jinja2.spec b/python-jinja2.spec index cbb6c8a..6c81bf7 100644 --- a/python-jinja2.spec +++ b/python-jinja2.spec @@ -1,8 +1,8 @@ %global srcname Jinja2 Name: python-jinja2 -Version: 3.0.1 -Release: 4%{?dist} +Version: 3.0.3 +Release: 1%{?dist} Summary: General purpose template engine License: BSD URL: https://palletsprojects.com/p/jinja/ @@ -10,8 +10,6 @@ Source0: %{pypi_source} # Tests: Make "Traceback did not match" an actual f-string Patch1: https://github.com/pallets/jinja/pull/1525.patch -# Tests: Adapt expected traceback regexes for Python 3.11.0a1 -Patch2: https://github.com/pallets/jinja/pull/1527.patch # Enable building without docs to avoid a circular dependency between this # and python-sphinx: @@ -38,7 +36,7 @@ BuildRequires: python3-devel %if %{with docs} BuildRequires: %{_bindir}/sphinx-build-3 BuildRequires: make -BuildRequires: python3-Pallets-Sphinx-Themes +BuildRequires: python3-Pallets-Sphinx-Themes >= 2 BuildRequires: python3-sphinxcontrib-log-cabinet BuildRequires: python3-sphinx-issues %endif @@ -84,6 +82,9 @@ rm -rvf docs/_build/html/.buildinfo %changelog +* Mon Nov 15 2021 Thomas Moschny - 3.0.3-1 +- Update to 3.0.3. + * Mon Nov 15 2021 Thomas Moschny - 3.0.1-4 - Use new Python packaging guidelines. - Jinja2 version 3 does not support Python 2 anymore. diff --git a/sources b/sources index 166072d..d2d7771 100644 --- a/sources +++ b/sources @@ -1 +1 @@ -SHA512 (Jinja2-3.0.1.tar.gz) = 18ca56fb2271885c41982d2a3b2daa8bdc7a95191f54d8eec96ddbe001ac995b3fae766b603d8c9287413e5227062b771575012cd92a3f64ed76067d5f168701 +SHA512 (Jinja2-3.0.3.tar.gz) = 51703d396ffe35155ed216922294441e20d44cd1ab69674140146375d4964654cdb32b38945f22916e0de917bbc0cf406cb680c2e569f9225dbe1fe4063be0b0 From 9326937b8ee5bea35bdd39a793be6af0c139e860 Mon Sep 17 00:00:00 2001 From: Thomas Moschny Date: Mon, 15 Nov 2021 21:46:48 +0100 Subject: [PATCH 20/53] Re-add BR on pytest. --- python-jinja2.spec | 1 + 1 file changed, 1 insertion(+) diff --git a/python-jinja2.spec b/python-jinja2.spec index 6c81bf7..5206d81 100644 --- a/python-jinja2.spec +++ b/python-jinja2.spec @@ -33,6 +33,7 @@ environments.} %package -n python3-jinja2 Summary: %{summary} BuildRequires: python3-devel +BuildRequires: python3-pytest %if %{with docs} BuildRequires: %{_bindir}/sphinx-build-3 BuildRequires: make From abbbe06df6372ddb51820a1357b63e4c3cea4519 Mon Sep 17 00:00:00 2001 From: Fedora Release Engineering Date: Fri, 21 Jan 2022 12:57:26 +0000 Subject: [PATCH 21/53] - Rebuilt for https://fedoraproject.org/wiki/Fedora_36_Mass_Rebuild Signed-off-by: Fedora Release Engineering --- python-jinja2.spec | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/python-jinja2.spec b/python-jinja2.spec index 5206d81..7252529 100644 --- a/python-jinja2.spec +++ b/python-jinja2.spec @@ -2,7 +2,7 @@ Name: python-jinja2 Version: 3.0.3 -Release: 1%{?dist} +Release: 2%{?dist} Summary: General purpose template engine License: BSD URL: https://palletsprojects.com/p/jinja/ @@ -83,6 +83,9 @@ rm -rvf docs/_build/html/.buildinfo %changelog +* Fri Jan 21 2022 Fedora Release Engineering - 3.0.3-2 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_36_Mass_Rebuild + * Mon Nov 15 2021 Thomas Moschny - 3.0.3-1 - Update to 3.0.3. From 5147748d39d3818a51410e67c1fcd52ac6dc79f7 Mon Sep 17 00:00:00 2001 From: Python Maint Date: Mon, 13 Jun 2022 17:36:16 +0200 Subject: [PATCH 22/53] Bootstrap for Python 3.11 --- python-jinja2.spec | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/python-jinja2.spec b/python-jinja2.spec index 7252529..c041da3 100644 --- a/python-jinja2.spec +++ b/python-jinja2.spec @@ -1,8 +1,9 @@ +%global _without_docs 1 %global srcname Jinja2 Name: python-jinja2 Version: 3.0.3 -Release: 2%{?dist} +Release: 3%{?dist} Summary: General purpose template engine License: BSD URL: https://palletsprojects.com/p/jinja/ @@ -83,6 +84,9 @@ rm -rvf docs/_build/html/.buildinfo %changelog +* Mon Jun 13 2022 Python Maint - 3.0.3-3 +- Bootstrap for Python 3.11 + * Fri Jan 21 2022 Fedora Release Engineering - 3.0.3-2 - Rebuilt for https://fedoraproject.org/wiki/Fedora_36_Mass_Rebuild From 86d162e6a12417c5773ef65817b55a5ef4a473a6 Mon Sep 17 00:00:00 2001 From: Python Maint Date: Mon, 13 Jun 2022 18:40:52 +0200 Subject: [PATCH 23/53] Rebuilt for Python 3.11 --- python-jinja2.spec | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/python-jinja2.spec b/python-jinja2.spec index c041da3..7dede72 100644 --- a/python-jinja2.spec +++ b/python-jinja2.spec @@ -1,9 +1,8 @@ -%global _without_docs 1 %global srcname Jinja2 Name: python-jinja2 Version: 3.0.3 -Release: 3%{?dist} +Release: 4%{?dist} Summary: General purpose template engine License: BSD URL: https://palletsprojects.com/p/jinja/ @@ -84,6 +83,9 @@ rm -rvf docs/_build/html/.buildinfo %changelog +* Mon Jun 13 2022 Python Maint - 3.0.3-4 +- Rebuilt for Python 3.11 + * Mon Jun 13 2022 Python Maint - 3.0.3-3 - Bootstrap for Python 3.11 From e059429ee9c5acac0fa2b1a8f3670dd4b98d77bb Mon Sep 17 00:00:00 2001 From: Fedora Release Engineering Date: Fri, 22 Jul 2022 19:29:03 +0000 Subject: [PATCH 24/53] Rebuilt for https://fedoraproject.org/wiki/Fedora_37_Mass_Rebuild Signed-off-by: Fedora Release Engineering --- python-jinja2.spec | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/python-jinja2.spec b/python-jinja2.spec index 7dede72..690a3a1 100644 --- a/python-jinja2.spec +++ b/python-jinja2.spec @@ -2,7 +2,7 @@ Name: python-jinja2 Version: 3.0.3 -Release: 4%{?dist} +Release: 5%{?dist} Summary: General purpose template engine License: BSD URL: https://palletsprojects.com/p/jinja/ @@ -83,6 +83,9 @@ rm -rvf docs/_build/html/.buildinfo %changelog +* Fri Jul 22 2022 Fedora Release Engineering - 3.0.3-5 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_37_Mass_Rebuild + * Mon Jun 13 2022 Python Maint - 3.0.3-4 - Rebuilt for Python 3.11 From 7387df56e9f54d64d1664e59aedc8edb4c09e825 Mon Sep 17 00:00:00 2001 From: Lumir Balhar Date: Fri, 11 Nov 2022 18:15:31 +0100 Subject: [PATCH 25/53] Fix compatibility with pytest 7.2.0 --- python-jinja2.spec | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/python-jinja2.spec b/python-jinja2.spec index 690a3a1..b910b09 100644 --- a/python-jinja2.spec +++ b/python-jinja2.spec @@ -2,7 +2,7 @@ Name: python-jinja2 Version: 3.0.3 -Release: 5%{?dist} +Release: 6%{?dist} Summary: General purpose template engine License: BSD URL: https://palletsprojects.com/p/jinja/ @@ -50,6 +50,8 @@ BuildRequires: python3-sphinx-issues %prep %autosetup -p1 -n %{srcname}-%{version} +# Fix for https://github.com/pallets/jinja/issues/1758 +sed -i "s/def teardown/def teardown_method/" tests/test_loader.py %generate_buildrequires %pyproject_buildrequires -x i18n @@ -83,6 +85,9 @@ rm -rvf docs/_build/html/.buildinfo %changelog +* Mon Nov 14 2022 Lumír Balhar - 3.0.3-6 +- Fix compatibility with pytest 7.2 + * Fri Jul 22 2022 Fedora Release Engineering - 3.0.3-5 - Rebuilt for https://fedoraproject.org/wiki/Fedora_37_Mass_Rebuild From ba5d786db5abb63fc2f77d26239470d8b6121321 Mon Sep 17 00:00:00 2001 From: Fedora Release Engineering Date: Fri, 20 Jan 2023 14:08:29 +0000 Subject: [PATCH 26/53] Rebuilt for https://fedoraproject.org/wiki/Fedora_38_Mass_Rebuild Signed-off-by: Fedora Release Engineering --- python-jinja2.spec | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/python-jinja2.spec b/python-jinja2.spec index b910b09..9f009a1 100644 --- a/python-jinja2.spec +++ b/python-jinja2.spec @@ -2,7 +2,7 @@ Name: python-jinja2 Version: 3.0.3 -Release: 6%{?dist} +Release: 7%{?dist} Summary: General purpose template engine License: BSD URL: https://palletsprojects.com/p/jinja/ @@ -85,6 +85,9 @@ rm -rvf docs/_build/html/.buildinfo %changelog +* Fri Jan 20 2023 Fedora Release Engineering - 3.0.3-7 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_38_Mass_Rebuild + * Mon Nov 14 2022 Lumír Balhar - 3.0.3-6 - Fix compatibility with pytest 7.2 From 200fff0803b36c0f2a29e916e0da2505a46335c2 Mon Sep 17 00:00:00 2001 From: Sandro Mani Date: Tue, 2 May 2023 00:21:00 +0200 Subject: [PATCH 27/53] Update to 3.1.2 --- 1525.patch | 33 --------------------------------- python-jinja2.spec | 12 ++++++------ sources | 2 +- 3 files changed, 7 insertions(+), 40 deletions(-) delete mode 100644 1525.patch diff --git a/1525.patch b/1525.patch deleted file mode 100644 index 1528f23..0000000 --- a/1525.patch +++ /dev/null @@ -1,33 +0,0 @@ -From e32c985af3a419ae2ea0853ad8084a12ab62745b Mon Sep 17 00:00:00 2001 -From: =?UTF-8?q?Miro=20Hron=C4=8Dok?= -Date: Tue, 2 Nov 2021 16:47:28 +0100 -Subject: [PATCH] Tests: Make "Traceback did not match" an actual f-string - -Otherwise the failure looks like this: - - > assert ( - m is not None - ), "Traceback did not match:\n\n{''.join(tb)}\nexpected:\n{expected_tb}" - E AssertionError: Traceback did not match: - E - E {''.join(tb)} - E expected: - E {expected_tb} - E assert None is not None ---- - tests/test_debug.py | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/tests/test_debug.py b/tests/test_debug.py -index 0aec78ae4..c639bbc29 100644 ---- a/tests/test_debug.py -+++ b/tests/test_debug.py -@@ -25,7 +25,7 @@ def assert_traceback_matches(self, callback, expected_tb): - m = re.search(expected_tb.strip(), "".join(tb)) - assert ( - m is not None -- ), "Traceback did not match:\n\n{''.join(tb)}\nexpected:\n{expected_tb}" -+ ), f"Traceback did not match:\n\n{''.join(tb)}\nexpected:\n{expected_tb}" - - def test_runtime_error(self, fs_env): - def test(): diff --git a/python-jinja2.spec b/python-jinja2.spec index 9f009a1..308a34f 100644 --- a/python-jinja2.spec +++ b/python-jinja2.spec @@ -1,15 +1,12 @@ %global srcname Jinja2 Name: python-jinja2 -Version: 3.0.3 -Release: 7%{?dist} +Version: 3.1.2 +Release: 1%{?dist} Summary: General purpose template engine License: BSD URL: https://palletsprojects.com/p/jinja/ -Source0: %{pypi_source} - -# Tests: Make "Traceback did not match" an actual f-string -Patch1: https://github.com/pallets/jinja/pull/1525.patch +Source0: %{pypi_source %srcname} # Enable building without docs to avoid a circular dependency between this # and python-sphinx: @@ -85,6 +82,9 @@ rm -rvf docs/_build/html/.buildinfo %changelog +* Mon May 01 2023 Sandro Mani - 3.1.2-1 +- Update to 3.1.2 + * Fri Jan 20 2023 Fedora Release Engineering - 3.0.3-7 - Rebuilt for https://fedoraproject.org/wiki/Fedora_38_Mass_Rebuild diff --git a/sources b/sources index d2d7771..0b8ad3a 100644 --- a/sources +++ b/sources @@ -1 +1 @@ -SHA512 (Jinja2-3.0.3.tar.gz) = 51703d396ffe35155ed216922294441e20d44cd1ab69674140146375d4964654cdb32b38945f22916e0de917bbc0cf406cb680c2e569f9225dbe1fe4063be0b0 +SHA512 (Jinja2-3.1.2.tar.gz) = 5dfe122c1beef5305b34d25f22f96607bd3a6cba098b03091850ea36fefe62b645a7218d7584b35bea252393ac922c9bb3654a9e90f23bcfb273e811fcf2f2c1 From 6eece4eaca98ab8858c33fc30750658b660fff3e Mon Sep 17 00:00:00 2001 From: Yaakov Selkowitz Date: Tue, 16 May 2023 17:04:21 -0400 Subject: [PATCH 28/53] Disable docs by default in RHEL builds RHEL does not include some of the doc dependencies. This is based on c9s: https://gitlab.com/redhat/centos-stream/rpms/python-jinja2/-/commit/8e7e566ba7e76950f083757e95a01c2b0cbc70e0 --- python-jinja2.spec | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/python-jinja2.spec b/python-jinja2.spec index 308a34f..ae67b5a 100644 --- a/python-jinja2.spec +++ b/python-jinja2.spec @@ -2,7 +2,7 @@ Name: python-jinja2 Version: 3.1.2 -Release: 1%{?dist} +Release: 2%{?dist} Summary: General purpose template engine License: BSD URL: https://palletsprojects.com/p/jinja/ @@ -10,7 +10,11 @@ Source0: %{pypi_source %srcname} # Enable building without docs to avoid a circular dependency between this # and python-sphinx: +%if 0%{?rhel} +%bcond_with docs +%else %bcond_without docs +%endif BuildArch: noarch @@ -82,6 +86,9 @@ rm -rvf docs/_build/html/.buildinfo %changelog +* Fri May 19 2023 Yaakov Selkowitz - 3.1.2-2 +- Disable docs by default in RHEL builds + * Mon May 01 2023 Sandro Mani - 3.1.2-1 - Update to 3.1.2 From 3c58a5d51941271db2b731c15eef2f7464f68fca Mon Sep 17 00:00:00 2001 From: Python Maint Date: Wed, 14 Jun 2023 00:03:28 +0200 Subject: [PATCH 29/53] Bootstrap for Python 3.12 --- python-jinja2.spec | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/python-jinja2.spec b/python-jinja2.spec index ae67b5a..1f482ae 100644 --- a/python-jinja2.spec +++ b/python-jinja2.spec @@ -1,8 +1,9 @@ +%global _without_docs 1 %global srcname Jinja2 Name: python-jinja2 Version: 3.1.2 -Release: 2%{?dist} +Release: 3%{?dist} Summary: General purpose template engine License: BSD URL: https://palletsprojects.com/p/jinja/ @@ -86,6 +87,9 @@ rm -rvf docs/_build/html/.buildinfo %changelog +* Tue Jun 13 2023 Python Maint - 3.1.2-3 +- Bootstrap for Python 3.12 + * Fri May 19 2023 Yaakov Selkowitz - 3.1.2-2 - Disable docs by default in RHEL builds From d228954a403b2b40fdb71414fd176e8d13b906cd Mon Sep 17 00:00:00 2001 From: Python Maint Date: Fri, 16 Jun 2023 08:18:06 +0200 Subject: [PATCH 30/53] Rebuilt for Python 3.12 --- python-jinja2.spec | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/python-jinja2.spec b/python-jinja2.spec index 1f482ae..7f381fd 100644 --- a/python-jinja2.spec +++ b/python-jinja2.spec @@ -1,9 +1,8 @@ -%global _without_docs 1 %global srcname Jinja2 Name: python-jinja2 Version: 3.1.2 -Release: 3%{?dist} +Release: 4%{?dist} Summary: General purpose template engine License: BSD URL: https://palletsprojects.com/p/jinja/ @@ -87,6 +86,9 @@ rm -rvf docs/_build/html/.buildinfo %changelog +* Fri Jun 16 2023 Python Maint - 3.1.2-4 +- Rebuilt for Python 3.12 + * Tue Jun 13 2023 Python Maint - 3.1.2-3 - Bootstrap for Python 3.12 From 05480f2accced7d8d9fd380a5b048aefbc6be1e4 Mon Sep 17 00:00:00 2001 From: Fedora Release Engineering Date: Fri, 21 Jul 2023 10:44:21 +0000 Subject: [PATCH 31/53] Rebuilt for https://fedoraproject.org/wiki/Fedora_39_Mass_Rebuild Signed-off-by: Fedora Release Engineering --- python-jinja2.spec | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/python-jinja2.spec b/python-jinja2.spec index 7f381fd..4b1f5df 100644 --- a/python-jinja2.spec +++ b/python-jinja2.spec @@ -2,7 +2,7 @@ Name: python-jinja2 Version: 3.1.2 -Release: 4%{?dist} +Release: 5%{?dist} Summary: General purpose template engine License: BSD URL: https://palletsprojects.com/p/jinja/ @@ -86,6 +86,9 @@ rm -rvf docs/_build/html/.buildinfo %changelog +* Fri Jul 21 2023 Fedora Release Engineering - 3.1.2-5 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_39_Mass_Rebuild + * Fri Jun 16 2023 Python Maint - 3.1.2-4 - Rebuilt for Python 3.12 From fc015d1bcf201262caa1525455193ca4305418d5 Mon Sep 17 00:00:00 2001 From: Yaakov Selkowitz Date: Tue, 1 Aug 2023 02:55:56 -0400 Subject: [PATCH 32/53] Disable docs in flatpak builds As of F39, flatpak builds will not be able to manually override macros. --- python-jinja2.spec | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/python-jinja2.spec b/python-jinja2.spec index 4b1f5df..9031193 100644 --- a/python-jinja2.spec +++ b/python-jinja2.spec @@ -10,7 +10,7 @@ Source0: %{pypi_source %srcname} # Enable building without docs to avoid a circular dependency between this # and python-sphinx: -%if 0%{?rhel} +%if 0%{?rhel} || 0%{?flatpak} %bcond_with docs %else %bcond_without docs From 7bb65e9cfd47fa69b6fbe65de8f5303a85054c24 Mon Sep 17 00:00:00 2001 From: Karolina Surma Date: Tue, 8 Aug 2023 15:07:41 +0200 Subject: [PATCH 33/53] Declare the license as an SPDX expression --- python-jinja2.spec | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/python-jinja2.spec b/python-jinja2.spec index 9031193..f907e91 100644 --- a/python-jinja2.spec +++ b/python-jinja2.spec @@ -2,9 +2,9 @@ Name: python-jinja2 Version: 3.1.2 -Release: 5%{?dist} +Release: 6%{?dist} Summary: General purpose template engine -License: BSD +License: BSD-3-Clause URL: https://palletsprojects.com/p/jinja/ Source0: %{pypi_source %srcname} @@ -86,6 +86,9 @@ rm -rvf docs/_build/html/.buildinfo %changelog +* Tue Aug 08 2023 Karolina Surma - 3.1.2-6 +- Declare the license as an SPDX expression + * Fri Jul 21 2023 Fedora Release Engineering - 3.1.2-5 - Rebuilt for https://fedoraproject.org/wiki/Fedora_39_Mass_Rebuild From 512d58d5216b9bb8b6f3082f077557092b6442f5 Mon Sep 17 00:00:00 2001 From: Michel Lind Date: Thu, 11 Jan 2024 10:57:45 -0600 Subject: [PATCH 34/53] Update to 3.1.3 to fix CVE-2024-22195 Signed-off-by: Michel Lind --- python-jinja2.spec | 7 +++++-- sources | 2 +- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/python-jinja2.spec b/python-jinja2.spec index f907e91..f3e035b 100644 --- a/python-jinja2.spec +++ b/python-jinja2.spec @@ -1,8 +1,8 @@ %global srcname Jinja2 Name: python-jinja2 -Version: 3.1.2 -Release: 6%{?dist} +Version: 3.1.3 +Release: 1%{?dist} Summary: General purpose template engine License: BSD-3-Clause URL: https://palletsprojects.com/p/jinja/ @@ -86,6 +86,9 @@ rm -rvf docs/_build/html/.buildinfo %changelog +* Thu Jan 11 2024 Michel Lind - 3.1.3-1 +- Update to 3.1.3 to fix CVE-2024-22195 + * Tue Aug 08 2023 Karolina Surma - 3.1.2-6 - Declare the license as an SPDX expression diff --git a/sources b/sources index 0b8ad3a..650df3d 100644 --- a/sources +++ b/sources @@ -1 +1 @@ -SHA512 (Jinja2-3.1.2.tar.gz) = 5dfe122c1beef5305b34d25f22f96607bd3a6cba098b03091850ea36fefe62b645a7218d7584b35bea252393ac922c9bb3654a9e90f23bcfb273e811fcf2f2c1 +SHA512 (Jinja2-3.1.3.tar.gz) = 5c36d0cd094b40626511f30c561176c095c49ef4066c2752a9edc3e6feb2430dafa866c17deebddcd0168aa1f0fd3944916d592c5c999639b8152e7c1009c700 From 0a28ad92e79c51ca1576b286e9b04af75911b976 Mon Sep 17 00:00:00 2001 From: Fedora Release Engineering Date: Mon, 22 Jan 2024 02:45:08 +0000 Subject: [PATCH 35/53] Rebuilt for https://fedoraproject.org/wiki/Fedora_40_Mass_Rebuild --- python-jinja2.spec | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/python-jinja2.spec b/python-jinja2.spec index f3e035b..e84bdd1 100644 --- a/python-jinja2.spec +++ b/python-jinja2.spec @@ -2,7 +2,7 @@ Name: python-jinja2 Version: 3.1.3 -Release: 1%{?dist} +Release: 2%{?dist} Summary: General purpose template engine License: BSD-3-Clause URL: https://palletsprojects.com/p/jinja/ @@ -86,6 +86,9 @@ rm -rvf docs/_build/html/.buildinfo %changelog +* Mon Jan 22 2024 Fedora Release Engineering - 3.1.3-2 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_40_Mass_Rebuild + * Thu Jan 11 2024 Michel Lind - 3.1.3-1 - Update to 3.1.3 to fix CVE-2024-22195 From 9aeba43e961704e825aa841f8d31393ca5d3ee82 Mon Sep 17 00:00:00 2001 From: Fedora Release Engineering Date: Fri, 26 Jan 2024 05:41:08 +0000 Subject: [PATCH 36/53] Rebuilt for https://fedoraproject.org/wiki/Fedora_40_Mass_Rebuild --- python-jinja2.spec | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/python-jinja2.spec b/python-jinja2.spec index e84bdd1..455bb37 100644 --- a/python-jinja2.spec +++ b/python-jinja2.spec @@ -2,7 +2,7 @@ Name: python-jinja2 Version: 3.1.3 -Release: 2%{?dist} +Release: 3%{?dist} Summary: General purpose template engine License: BSD-3-Clause URL: https://palletsprojects.com/p/jinja/ @@ -86,6 +86,9 @@ rm -rvf docs/_build/html/.buildinfo %changelog +* Fri Jan 26 2024 Fedora Release Engineering - 3.1.3-3 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_40_Mass_Rebuild + * Mon Jan 22 2024 Fedora Release Engineering - 3.1.3-2 - Rebuilt for https://fedoraproject.org/wiki/Fedora_40_Mass_Rebuild From 4d9e43b39a4cbe4fc4c7a06e61d1ee3bf01ee65e Mon Sep 17 00:00:00 2001 From: Tim Landscheidt Date: Sun, 17 Mar 2024 23:06:05 +0000 Subject: [PATCH 37/53] Remove outdated sed to rename test teardown methods The issue was fixed in 3.1.3 via https://github.com/pallets/jinja/commit/3fadee01b712580d811bdd2cb06cd8a1b5ee0821 The sed turns teardown_method into teardown_method_method. --- python-jinja2.spec | 2 -- 1 file changed, 2 deletions(-) diff --git a/python-jinja2.spec b/python-jinja2.spec index 455bb37..f94bee6 100644 --- a/python-jinja2.spec +++ b/python-jinja2.spec @@ -51,8 +51,6 @@ BuildRequires: python3-sphinx-issues %prep %autosetup -p1 -n %{srcname}-%{version} -# Fix for https://github.com/pallets/jinja/issues/1758 -sed -i "s/def teardown/def teardown_method/" tests/test_loader.py %generate_buildrequires %pyproject_buildrequires -x i18n From 18d1a5374f68be5e4533052708a9afdf9883cc00 Mon Sep 17 00:00:00 2001 From: Lumir Balhar Date: Tue, 7 May 2024 13:38:16 +0200 Subject: [PATCH 38/53] Update to 3.1.4 (rhbz#2279211) --- .gitignore | 1 + python-jinja2.spec | 15 +++++++++------ sources | 2 +- 3 files changed, 11 insertions(+), 7 deletions(-) diff --git a/.gitignore b/.gitignore index 02c0702..ced8d09 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,2 @@ /Jinja2-*.tar.gz +/jinja2-3.1.4.tar.gz diff --git a/python-jinja2.spec b/python-jinja2.spec index f94bee6..13a2274 100644 --- a/python-jinja2.spec +++ b/python-jinja2.spec @@ -1,8 +1,8 @@ -%global srcname Jinja2 +%global srcname jinja2 Name: python-jinja2 -Version: 3.1.3 -Release: 3%{?dist} +Version: 3.1.4 +Release: 1%{?dist} Summary: General purpose template engine License: BSD-3-Clause URL: https://palletsprojects.com/p/jinja/ @@ -75,15 +75,18 @@ rm -rvf docs/_build/html/.buildinfo %files -n python3-jinja2 -f %{pyproject_files} -%doc CHANGES.rst -%doc examples -%license LICENSE.rst +%doc README.md +%doc docs/examples +%license LICENSE.txt %if %{with docs} %doc docs/_build/html %endif %changelog +* Tue May 07 2024 Lumír Balhar - 3.1.4-1 +- Update to 3.1.4 (rhbz#2279211,rhbz#2279491) + * Fri Jan 26 2024 Fedora Release Engineering - 3.1.3-3 - Rebuilt for https://fedoraproject.org/wiki/Fedora_40_Mass_Rebuild diff --git a/sources b/sources index 650df3d..04e4371 100644 --- a/sources +++ b/sources @@ -1 +1 @@ -SHA512 (Jinja2-3.1.3.tar.gz) = 5c36d0cd094b40626511f30c561176c095c49ef4066c2752a9edc3e6feb2430dafa866c17deebddcd0168aa1f0fd3944916d592c5c999639b8152e7c1009c700 +SHA512 (jinja2-3.1.4.tar.gz) = d07d68a2687af68c705d3b7f5a2c67aca7b9d125316b15085888b9d0d6e769981af76f6f524728b89b5501bd671d518fcb2638f9ae112e57ca2bf2a53482cd89 From e84a72433ecf5475fc0a5e87f3d2aeb20591b2ca Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Miro=20Hron=C4=8Dok?= Date: Thu, 23 May 2024 15:32:31 +0200 Subject: [PATCH 39/53] Python 3.13 fixes - Fixes: rhzb#2245265 --- python-jinja2.spec | 12 +- python3.13.patch | 581 +++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 592 insertions(+), 1 deletion(-) create mode 100644 python3.13.patch diff --git a/python-jinja2.spec b/python-jinja2.spec index 13a2274..053e95d 100644 --- a/python-jinja2.spec +++ b/python-jinja2.spec @@ -2,12 +2,17 @@ Name: python-jinja2 Version: 3.1.4 -Release: 1%{?dist} +Release: 2%{?dist} Summary: General purpose template engine License: BSD-3-Clause URL: https://palletsprojects.com/p/jinja/ Source0: %{pypi_source %srcname} +# Python 3.13 fixes +# https://github.com/pallets/jinja/pull/1960 +# https://github.com/pallets/jinja/pull/1977 +Patch: python3.13.patch + # Enable building without docs to avoid a circular dependency between this # and python-sphinx: %if 0%{?rhel} || 0%{?flatpak} @@ -35,6 +40,7 @@ environments.} Summary: %{summary} BuildRequires: python3-devel BuildRequires: python3-pytest +BuildRequires: python3-trio %if %{with docs} BuildRequires: %{_bindir}/sphinx-build-3 BuildRequires: make @@ -84,6 +90,10 @@ rm -rvf docs/_build/html/.buildinfo %changelog +* Thu May 23 2024 Miro Hrončok - 3.1.4-2 +- Python 3.13 fixes +- Fixes: rhzb#2245265 + * Tue May 07 2024 Lumír Balhar - 3.1.4-1 - Update to 3.1.4 (rhbz#2279211,rhbz#2279491) diff --git a/python3.13.patch b/python3.13.patch new file mode 100644 index 0000000..d0b021e --- /dev/null +++ b/python3.13.patch @@ -0,0 +1,581 @@ +From d44af7635fa97e980673f29c6192d9fc5cbfc85a Mon Sep 17 00:00:00 2001 +From: Thomas Grainger +Date: Thu, 23 May 2024 15:30:36 +0200 +Subject: [PATCH] Python 3.13 fixes + +Combined from: + - https://github.com/pallets/jinja/pull/1960 + - https://github.com/pallets/jinja/pull/1977 + +Co-Authored-By: David Lord +--- + src/jinja2/async_utils.py | 25 ++++++-- + src/jinja2/compiler.py | 46 +++++++++----- + src/jinja2/environment.py | 12 +++- + tests/test_async.py | 122 +++++++++++++++++++++++++++++------- + tests/test_async_filters.py | 67 ++++++++++++++++---- + tests/test_loader.py | 5 +- + 6 files changed, 214 insertions(+), 63 deletions(-) + +diff --git a/src/jinja2/async_utils.py b/src/jinja2/async_utils.py +index e65219e..b0d277d 100644 +--- a/src/jinja2/async_utils.py ++++ b/src/jinja2/async_utils.py +@@ -6,6 +6,9 @@ from functools import wraps + from .utils import _PassArg + from .utils import pass_eval_context + ++if t.TYPE_CHECKING: ++ import typing_extensions as te ++ + V = t.TypeVar("V") + + +@@ -67,15 +70,27 @@ async def auto_await(value: t.Union[t.Awaitable["V"], "V"]) -> "V": + return t.cast("V", value) + + +-async def auto_aiter( ++class _IteratorToAsyncIterator(t.Generic[V]): ++ def __init__(self, iterator: "t.Iterator[V]"): ++ self._iterator = iterator ++ ++ def __aiter__(self) -> "te.Self": ++ return self ++ ++ async def __anext__(self) -> V: ++ try: ++ return next(self._iterator) ++ except StopIteration as e: ++ raise StopAsyncIteration(e.value) from e ++ ++ ++def auto_aiter( + iterable: "t.Union[t.AsyncIterable[V], t.Iterable[V]]", + ) -> "t.AsyncIterator[V]": + if hasattr(iterable, "__aiter__"): +- async for item in t.cast("t.AsyncIterable[V]", iterable): +- yield item ++ return iterable.__aiter__() + else: +- for item in iterable: +- yield item ++ return _IteratorToAsyncIterator(iter(iterable)) + + + async def auto_to_list( +diff --git a/src/jinja2/compiler.py b/src/jinja2/compiler.py +index 2740717..91720c5 100644 +--- a/src/jinja2/compiler.py ++++ b/src/jinja2/compiler.py +@@ -55,7 +55,7 @@ def optimizeconst(f: F) -> F: + + return f(self, node, frame, **kwargs) + +- return update_wrapper(t.cast(F, new_func), f) ++ return update_wrapper(new_func, f) # type: ignore[return-value] + + + def _make_binop(op: str) -> t.Callable[["CodeGenerator", nodes.BinExpr, "Frame"], None]: +@@ -902,12 +902,15 @@ class CodeGenerator(NodeVisitor): + if not self.environment.is_async: + self.writeline("yield from parent_template.root_render_func(context)") + else: +- self.writeline( +- "async for event in parent_template.root_render_func(context):" +- ) ++ self.writeline("agen = parent_template.root_render_func(context)") ++ self.writeline("try:") ++ self.indent() ++ self.writeline("async for event in agen:") + self.indent() + self.writeline("yield event") + self.outdent() ++ self.outdent() ++ self.writeline("finally: await agen.aclose()") + self.outdent(1 + (not self.has_known_extends)) + + # at this point we now have the blocks collected and can visit them too. +@@ -977,14 +980,20 @@ class CodeGenerator(NodeVisitor): + f"yield from context.blocks[{node.name!r}][0]({context})", node + ) + else: ++ self.writeline(f"gen = context.blocks[{node.name!r}][0]({context})") ++ self.writeline("try:") ++ self.indent() + self.writeline( +- f"{self.choose_async()}for event in" +- f" context.blocks[{node.name!r}][0]({context}):", ++ f"{self.choose_async()}for event in gen:", + node, + ) + self.indent() + self.simple_write("event", frame) + self.outdent() ++ self.outdent() ++ self.writeline( ++ f"finally: {self.choose_async('await gen.aclose()', 'gen.close()')}" ++ ) + + self.outdent(level) + +@@ -1057,26 +1066,33 @@ class CodeGenerator(NodeVisitor): + self.writeline("else:") + self.indent() + +- skip_event_yield = False ++ def loop_body() -> None: ++ self.indent() ++ self.simple_write("event", frame) ++ self.outdent() ++ + if node.with_context: + self.writeline( +- f"{self.choose_async()}for event in template.root_render_func(" ++ f"gen = template.root_render_func(" + "template.new_context(context.get_all(), True," +- f" {self.dump_local_context(frame)})):" ++ f" {self.dump_local_context(frame)}))" ++ ) ++ self.writeline("try:") ++ self.indent() ++ self.writeline(f"{self.choose_async()}for event in gen:") ++ loop_body() ++ self.outdent() ++ self.writeline( ++ f"finally: {self.choose_async('await gen.aclose()', 'gen.close()')}" + ) + elif self.environment.is_async: + self.writeline( + "for event in (await template._get_default_module_async())" + "._body_stream:" + ) ++ loop_body() + else: + self.writeline("yield from template._get_default_module()._body_stream") +- skip_event_yield = True +- +- if not skip_event_yield: +- self.indent() +- self.simple_write("event", frame) +- self.outdent() + + if node.ignore_missing: + self.outdent() +diff --git a/src/jinja2/environment.py b/src/jinja2/environment.py +index 1d3be0b..bdd6a2b 100644 +--- a/src/jinja2/environment.py ++++ b/src/jinja2/environment.py +@@ -1358,7 +1358,7 @@ class Template: + + async def generate_async( + self, *args: t.Any, **kwargs: t.Any +- ) -> t.AsyncIterator[str]: ++ ) -> t.AsyncGenerator[str, object]: + """An async version of :meth:`generate`. Works very similarly but + returns an async iterator instead. + """ +@@ -1370,8 +1370,14 @@ class Template: + ctx = self.new_context(dict(*args, **kwargs)) + + try: +- async for event in self.root_render_func(ctx): # type: ignore +- yield event ++ agen = self.root_render_func(ctx) ++ try: ++ async for event in agen: # type: ignore ++ yield event ++ finally: ++ # we can't use async with aclosing(...) because that's only ++ # in 3.10+ ++ await agen.aclose() # type: ignore + except Exception: + yield self.environment.handle_exception() + +diff --git a/tests/test_async.py b/tests/test_async.py +index c9ba70c..4edced9 100644 +--- a/tests/test_async.py ++++ b/tests/test_async.py +@@ -1,6 +1,7 @@ + import asyncio + + import pytest ++import trio + + from jinja2 import ChainableUndefined + from jinja2 import DictLoader +@@ -13,7 +14,16 @@ from jinja2.exceptions import UndefinedError + from jinja2.nativetypes import NativeEnvironment + + +-def test_basic_async(): ++def _asyncio_run(async_fn, *args): ++ return asyncio.run(async_fn(*args)) ++ ++ ++@pytest.fixture(params=[_asyncio_run, trio.run], ids=["asyncio", "trio"]) ++def run_async_fn(request): ++ return request.param ++ ++ ++def test_basic_async(run_async_fn): + t = Template( + "{% for item in [1, 2, 3] %}[{{ item }}]{% endfor %}", enable_async=True + ) +@@ -21,11 +31,11 @@ def test_basic_async(): + async def func(): + return await t.render_async() + +- rv = asyncio.run(func()) ++ rv = run_async_fn(func) + assert rv == "[1][2][3]" + + +-def test_await_on_calls(): ++def test_await_on_calls(run_async_fn): + t = Template("{{ async_func() + normal_func() }}", enable_async=True) + + async def async_func(): +@@ -37,7 +47,7 @@ def test_await_on_calls(): + async def func(): + return await t.render_async(async_func=async_func, normal_func=normal_func) + +- rv = asyncio.run(func()) ++ rv = run_async_fn(func) + assert rv == "65" + + +@@ -54,7 +64,7 @@ def test_await_on_calls_normal_render(): + assert rv == "65" + + +-def test_await_and_macros(): ++def test_await_and_macros(run_async_fn): + t = Template( + "{% macro foo(x) %}[{{ x }}][{{ async_func() }}]{% endmacro %}{{ foo(42) }}", + enable_async=True, +@@ -66,11 +76,11 @@ def test_await_and_macros(): + async def func(): + return await t.render_async(async_func=async_func) + +- rv = asyncio.run(func()) ++ rv = run_async_fn(func) + assert rv == "[42][42]" + + +-def test_async_blocks(): ++def test_async_blocks(run_async_fn): + t = Template( + "{% block foo %}{% endblock %}{{ self.foo() }}", + enable_async=True, +@@ -80,7 +90,7 @@ def test_async_blocks(): + async def func(): + return await t.render_async() + +- rv = asyncio.run(func()) ++ rv = run_async_fn(func) + assert rv == "" + + +@@ -156,8 +166,8 @@ class TestAsyncImports: + test_env_async.from_string('{% from "foo" import bar, with, context %}') + test_env_async.from_string('{% from "foo" import bar, with with context %}') + +- def test_exports(self, test_env_async): +- coro = test_env_async.from_string( ++ def test_exports(self, test_env_async, run_async_fn): ++ coro_fn = test_env_async.from_string( + """ + {% macro toplevel() %}...{% endmacro %} + {% macro __private() %}...{% endmacro %} +@@ -166,9 +176,9 @@ class TestAsyncImports: + {% macro notthere() %}{% endmacro %} + {% endfor %} + """ +- )._get_default_module_async() +- m = asyncio.run(coro) +- assert asyncio.run(m.toplevel()) == "..." ++ )._get_default_module_async ++ m = run_async_fn(coro_fn) ++ assert run_async_fn(m.toplevel) == "..." + assert not hasattr(m, "__missing") + assert m.variable == 42 + assert not hasattr(m, "notthere") +@@ -457,17 +467,19 @@ class TestAsyncForLoop: + ) + assert tmpl.render(items=reversed([3, 2, 1])) == "1,2,3" + +- def test_loop_errors(self, test_env_async): ++ def test_loop_errors(self, test_env_async, run_async_fn): + tmpl = test_env_async.from_string( + """{% for item in [1] if loop.index + == 0 %}...{% endfor %}""" + ) +- pytest.raises(UndefinedError, tmpl.render) ++ with pytest.raises(UndefinedError): ++ run_async_fn(tmpl.render_async) ++ + tmpl = test_env_async.from_string( + """{% for item in [] %}...{% else + %}{{ loop }}{% endfor %}""" + ) +- assert tmpl.render() == "" ++ assert run_async_fn(tmpl.render_async) == "" + + def test_loop_filter(self, test_env_async): + tmpl = test_env_async.from_string( +@@ -597,7 +609,7 @@ class TestAsyncForLoop: + assert t.render(a=dict(b=[1, 2, 3])) == "1" + + +-def test_namespace_awaitable(test_env_async): ++def test_namespace_awaitable(test_env_async, run_async_fn): + async def _test(): + t = test_env_async.from_string( + '{% set ns = namespace(foo="Bar") %}{{ ns.foo }}' +@@ -605,10 +617,10 @@ def test_namespace_awaitable(test_env_async): + actual = await t.render_async() + assert actual == "Bar" + +- asyncio.run(_test()) ++ run_async_fn(_test) + + +-def test_chainable_undefined_aiter(): ++def test_chainable_undefined_aiter(run_async_fn): + async def _test(): + t = Template( + "{% for x in a['b']['c'] %}{{ x }}{% endfor %}", +@@ -618,7 +630,7 @@ def test_chainable_undefined_aiter(): + rv = await t.render_async(a={}) + assert rv == "" + +- asyncio.run(_test()) ++ run_async_fn(_test) + + + @pytest.fixture +@@ -626,22 +638,22 @@ def async_native_env(): + return NativeEnvironment(enable_async=True) + + +-def test_native_async(async_native_env): ++def test_native_async(async_native_env, run_async_fn): + async def _test(): + t = async_native_env.from_string("{{ x }}") + rv = await t.render_async(x=23) + assert rv == 23 + +- asyncio.run(_test()) ++ run_async_fn(_test) + + +-def test_native_list_async(async_native_env): ++def test_native_list_async(async_native_env, run_async_fn): + async def _test(): + t = async_native_env.from_string("{{ x }}") + rv = await t.render_async(x=list(range(3))) + assert rv == [0, 1, 2] + +- asyncio.run(_test()) ++ run_async_fn(_test) + + + def test_getitem_after_filter(): +@@ -658,3 +670,65 @@ def test_getitem_after_call(): + t = env.from_string("{{ add_each(a, 2)[1:] }}") + out = t.render(a=range(3)) + assert out == "[3, 4]" ++ ++ ++def test_basic_generate_async(run_async_fn): ++ t = Template( ++ "{% for item in [1, 2, 3] %}[{{ item }}]{% endfor %}", enable_async=True ++ ) ++ ++ async def func(): ++ agen = t.generate_async() ++ try: ++ return await agen.__anext__() ++ finally: ++ await agen.aclose() ++ ++ rv = run_async_fn(func) ++ assert rv == "[" ++ ++ ++def test_include_generate_async(run_async_fn, test_env_async): ++ t = test_env_async.from_string('{% include "header" %}') ++ ++ async def func(): ++ agen = t.generate_async() ++ try: ++ return await agen.__anext__() ++ finally: ++ await agen.aclose() ++ ++ rv = run_async_fn(func) ++ assert rv == "[" ++ ++ ++def test_blocks_generate_async(run_async_fn): ++ t = Template( ++ "{% block foo %}{% endblock %}{{ self.foo() }}", ++ enable_async=True, ++ autoescape=True, ++ ) ++ ++ async def func(): ++ agen = t.generate_async() ++ try: ++ return await agen.__anext__() ++ finally: ++ await agen.aclose() ++ ++ rv = run_async_fn(func) ++ assert rv == "" ++ ++ ++def test_async_extend(run_async_fn, test_env_async): ++ t = test_env_async.from_string('{% extends "header" %}') ++ ++ async def func(): ++ agen = t.generate_async() ++ try: ++ return await agen.__anext__() ++ finally: ++ await agen.aclose() ++ ++ rv = run_async_fn(func) ++ assert rv == "[" +diff --git a/tests/test_async_filters.py b/tests/test_async_filters.py +index f5b2627..e8cc350 100644 +--- a/tests/test_async_filters.py ++++ b/tests/test_async_filters.py +@@ -1,6 +1,9 @@ ++import asyncio ++import contextlib + from collections import namedtuple + + import pytest ++import trio + from markupsafe import Markup + + from jinja2 import Environment +@@ -26,10 +29,39 @@ def env_async(): + return Environment(enable_async=True) + + ++def _asyncio_run(async_fn, *args): ++ return asyncio.run(async_fn(*args)) ++ ++ ++@pytest.fixture(params=[_asyncio_run, trio.run], ids=["asyncio", "trio"]) ++def run_async_fn(request): ++ return request.param ++ ++ ++@contextlib.asynccontextmanager ++async def closing_factory(): ++ async with contextlib.AsyncExitStack() as stack: ++ ++ def closing(maybe_agen): ++ try: ++ aclose = maybe_agen.aclose ++ except AttributeError: ++ pass ++ else: ++ stack.push_async_callback(aclose) ++ return maybe_agen ++ ++ yield closing ++ ++ + @mark_dualiter("foo", lambda: range(10)) +-def test_first(env_async, foo): +- tmpl = env_async.from_string("{{ foo()|first }}") +- out = tmpl.render(foo=foo) ++def test_first(env_async, foo, run_async_fn): ++ async def test(): ++ async with closing_factory() as closing: ++ tmpl = env_async.from_string("{{ closing(foo())|first }}") ++ return await tmpl.render_async(foo=foo, closing=closing) ++ ++ out = run_async_fn(test) + assert out == "0" + + +@@ -245,18 +277,23 @@ def test_slice(env_async, items): + ) + + +-def test_custom_async_filter(env_async): ++def test_custom_async_filter(env_async, run_async_fn): + async def customfilter(val): + return str(val) + +- env_async.filters["customfilter"] = customfilter +- tmpl = env_async.from_string("{{ 'static'|customfilter }} {{ arg|customfilter }}") +- out = tmpl.render(arg="dynamic") ++ async def test(): ++ env_async.filters["customfilter"] = customfilter ++ tmpl = env_async.from_string( ++ "{{ 'static'|customfilter }} {{ arg|customfilter }}" ++ ) ++ return await tmpl.render_async(arg="dynamic") ++ ++ out = run_async_fn(test) + assert out == "static dynamic" + + + @mark_dualiter("items", lambda: range(10)) +-def test_custom_async_iteratable_filter(env_async, items): ++def test_custom_async_iteratable_filter(env_async, items, run_async_fn): + async def customfilter(iterable): + items = [] + async for item in auto_aiter(iterable): +@@ -265,9 +302,13 @@ def test_custom_async_iteratable_filter(env_async, items): + break + return ",".join(items) + +- env_async.filters["customfilter"] = customfilter +- tmpl = env_async.from_string( +- "{{ items()|customfilter }} .. {{ [3, 4, 5, 6]|customfilter }}" +- ) +- out = tmpl.render(items=items) ++ async def test(): ++ async with closing_factory() as closing: ++ env_async.filters["customfilter"] = customfilter ++ tmpl = env_async.from_string( ++ "{{ closing(items())|customfilter }} .. {{ [3, 4, 5, 6]|customfilter }}" ++ ) ++ return await tmpl.render_async(items=items, closing=closing) ++ ++ out = run_async_fn(test) + assert out == "0,1,2 .. 3,4,5" +diff --git a/tests/test_loader.py b/tests/test_loader.py +index 77d686e..3e64f62 100644 +--- a/tests/test_loader.py ++++ b/tests/test_loader.py +@@ -2,7 +2,6 @@ import importlib.abc + import importlib.machinery + import importlib.util + import os +-import platform + import shutil + import sys + import tempfile +@@ -364,8 +363,8 @@ def test_package_zip_source(package_zip_loader, template, expect): + + + @pytest.mark.xfail( +- platform.python_implementation() == "PyPy", +- reason="PyPy's zipimporter doesn't have a '_files' attribute.", ++ sys.implementation.name == "pypy" or sys.version_info > (3, 13), ++ reason="zipimporter doesn't have a '_files' attribute", + raises=TypeError, + ) + def test_package_zip_list(package_zip_loader): +-- +2.45.0 + From 0aec2152b2acae1d1a1ab75ab1e951de15fdc2a1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Miro=20Hron=C4=8Dok?= Date: Sun, 26 May 2024 01:18:20 +0200 Subject: [PATCH 40/53] Make the build dependency on trio optional --- python-jinja2.spec | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/python-jinja2.spec b/python-jinja2.spec index 053e95d..4692a09 100644 --- a/python-jinja2.spec +++ b/python-jinja2.spec @@ -20,6 +20,8 @@ Patch: python3.13.patch %else %bcond_without docs %endif +# The dependency on trio is undesired on RHEL +%bcond asyncio_tests %{undefined rhel} BuildArch: noarch @@ -40,7 +42,9 @@ environments.} Summary: %{summary} BuildRequires: python3-devel BuildRequires: python3-pytest +%if %{with asyncio_tests} BuildRequires: python3-trio +%endif %if %{with docs} BuildRequires: %{_bindir}/sphinx-build-3 BuildRequires: make @@ -77,7 +81,7 @@ rm -rvf docs/_build/html/.buildinfo %check -%pytest tests +%pytest tests %{!?with_asyncio_tests:--ignore tests/test_async.py --ignore tests/test_async_filters.py} %files -n python3-jinja2 -f %{pyproject_files} From 566054026e9196e9525a67bbde02cc20ae90146e Mon Sep 17 00:00:00 2001 From: Python Maint Date: Fri, 7 Jun 2024 13:21:17 +0200 Subject: [PATCH 41/53] Bootstrap for Python 3.13 --- python-jinja2.spec | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/python-jinja2.spec b/python-jinja2.spec index 4692a09..dfda1d4 100644 --- a/python-jinja2.spec +++ b/python-jinja2.spec @@ -1,8 +1,10 @@ +%global _without_asyncio_tests 1 +%global _without_docs 1 %global srcname jinja2 Name: python-jinja2 Version: 3.1.4 -Release: 2%{?dist} +Release: 3%{?dist} Summary: General purpose template engine License: BSD-3-Clause URL: https://palletsprojects.com/p/jinja/ @@ -94,6 +96,9 @@ rm -rvf docs/_build/html/.buildinfo %changelog +* Fri Jun 07 2024 Python Maint - 3.1.4-3 +- Bootstrap for Python 3.13 + * Thu May 23 2024 Miro Hrončok - 3.1.4-2 - Python 3.13 fixes - Fixes: rhzb#2245265 From da0819f188471416143af39442cc5e790af143a4 Mon Sep 17 00:00:00 2001 From: Python Maint Date: Sat, 8 Jun 2024 08:13:52 +0200 Subject: [PATCH 42/53] Rebuilt for Python 3.13 --- python-jinja2.spec | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/python-jinja2.spec b/python-jinja2.spec index dfda1d4..e7e45da 100644 --- a/python-jinja2.spec +++ b/python-jinja2.spec @@ -1,10 +1,8 @@ -%global _without_asyncio_tests 1 -%global _without_docs 1 %global srcname jinja2 Name: python-jinja2 Version: 3.1.4 -Release: 3%{?dist} +Release: 4%{?dist} Summary: General purpose template engine License: BSD-3-Clause URL: https://palletsprojects.com/p/jinja/ @@ -96,6 +94,9 @@ rm -rvf docs/_build/html/.buildinfo %changelog +* Sat Jun 08 2024 Python Maint - 3.1.4-4 +- Rebuilt for Python 3.13 + * Fri Jun 07 2024 Python Maint - 3.1.4-3 - Bootstrap for Python 3.13 From 5d9a9d69be022d256c56d7b19dad5befdde42ffc Mon Sep 17 00:00:00 2001 From: Fedora Release Engineering Date: Fri, 19 Jul 2024 12:31:17 +0000 Subject: [PATCH 43/53] Rebuilt for https://fedoraproject.org/wiki/Fedora_41_Mass_Rebuild --- python-jinja2.spec | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/python-jinja2.spec b/python-jinja2.spec index e7e45da..ff19dc9 100644 --- a/python-jinja2.spec +++ b/python-jinja2.spec @@ -2,7 +2,7 @@ Name: python-jinja2 Version: 3.1.4 -Release: 4%{?dist} +Release: 5%{?dist} Summary: General purpose template engine License: BSD-3-Clause URL: https://palletsprojects.com/p/jinja/ @@ -94,6 +94,9 @@ rm -rvf docs/_build/html/.buildinfo %changelog +* Fri Jul 19 2024 Fedora Release Engineering - 3.1.4-5 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_41_Mass_Rebuild + * Sat Jun 08 2024 Python Maint - 3.1.4-4 - Rebuilt for Python 3.13 From 46fea4b890cb5b3ed9eb0f255a58a17976f1e37c Mon Sep 17 00:00:00 2001 From: Lukas Zachar Date: Mon, 19 Jul 2021 09:50:49 +0200 Subject: [PATCH 44/53] Add tmt smoke test + plan Cherry-picked from c9s. Commit hash: 53acc26463e0248c91146bd2f6065d53fb845580 --- .fmf/version | 1 + plans.fmf | 4 ++++ tests/smoke.fmf | 7 +++++++ tests/smoke.py | 9 +++++++++ 4 files changed, 21 insertions(+) create mode 100644 .fmf/version create mode 100644 plans.fmf create mode 100644 tests/smoke.fmf create mode 100644 tests/smoke.py diff --git a/.fmf/version b/.fmf/version new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/.fmf/version @@ -0,0 +1 @@ +1 diff --git a/plans.fmf b/plans.fmf new file mode 100644 index 0000000..e6427de --- /dev/null +++ b/plans.fmf @@ -0,0 +1,4 @@ +discover: + how: fmf +execute: + how: tmt diff --git a/tests/smoke.fmf b/tests/smoke.fmf new file mode 100644 index 0000000..19656ca --- /dev/null +++ b/tests/smoke.fmf @@ -0,0 +1,7 @@ +description: | + Runs very simple jinja2 template which should always work +test: python3 smoke.py +framework: shell +require: +- python3 +- python3-jinja2 diff --git a/tests/smoke.py b/tests/smoke.py new file mode 100644 index 0000000..99a000c --- /dev/null +++ b/tests/smoke.py @@ -0,0 +1,9 @@ +import jinja2 + + +TEMPLATE = "Text {{ variable }}" + +environment = jinja2.Environment() +template = environment.from_string(TEMPLATE) +output = template.render(variable="demo") +assert output == "Text demo", f"got: {output}" From 48d55f47425c0db2356b4b1df759f1083f13ff8f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Miro=20Hron=C4=8Dok?= Date: Wed, 8 Jan 2025 11:23:11 +0100 Subject: [PATCH 45/53] Update to 3.1.5 - Security fix for CVE-2024-56201 - Fixes: rhzb#2333688 - Fixes: rhzb#2336377 --- .gitignore | 1 + python-jinja2.spec | 15 +- python3.13.patch | 581 --------------------------------------------- sources | 2 +- 4 files changed, 10 insertions(+), 589 deletions(-) delete mode 100644 python3.13.patch diff --git a/.gitignore b/.gitignore index ced8d09..38359a3 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,3 @@ /Jinja2-*.tar.gz /jinja2-3.1.4.tar.gz +/jinja2-3.1.5.tar.gz diff --git a/python-jinja2.spec b/python-jinja2.spec index ff19dc9..a5b4dd1 100644 --- a/python-jinja2.spec +++ b/python-jinja2.spec @@ -1,18 +1,13 @@ %global srcname jinja2 Name: python-jinja2 -Version: 3.1.4 -Release: 5%{?dist} +Version: 3.1.5 +Release: 1%{?dist} Summary: General purpose template engine License: BSD-3-Clause URL: https://palletsprojects.com/p/jinja/ Source0: %{pypi_source %srcname} -# Python 3.13 fixes -# https://github.com/pallets/jinja/pull/1960 -# https://github.com/pallets/jinja/pull/1977 -Patch: python3.13.patch - # Enable building without docs to avoid a circular dependency between this # and python-sphinx: %if 0%{?rhel} || 0%{?flatpak} @@ -94,6 +89,12 @@ rm -rvf docs/_build/html/.buildinfo %changelog +* Wed Jan 08 2025 Miro Hrončok - 3.1.5-1 +- Update to 3.1.5 +- Security fix for CVE-2024-56201 +- Fixes: rhzb#2333688 +- Fixes: rhzb#2336377 + * Fri Jul 19 2024 Fedora Release Engineering - 3.1.4-5 - Rebuilt for https://fedoraproject.org/wiki/Fedora_41_Mass_Rebuild diff --git a/python3.13.patch b/python3.13.patch deleted file mode 100644 index d0b021e..0000000 --- a/python3.13.patch +++ /dev/null @@ -1,581 +0,0 @@ -From d44af7635fa97e980673f29c6192d9fc5cbfc85a Mon Sep 17 00:00:00 2001 -From: Thomas Grainger -Date: Thu, 23 May 2024 15:30:36 +0200 -Subject: [PATCH] Python 3.13 fixes - -Combined from: - - https://github.com/pallets/jinja/pull/1960 - - https://github.com/pallets/jinja/pull/1977 - -Co-Authored-By: David Lord ---- - src/jinja2/async_utils.py | 25 ++++++-- - src/jinja2/compiler.py | 46 +++++++++----- - src/jinja2/environment.py | 12 +++- - tests/test_async.py | 122 +++++++++++++++++++++++++++++------- - tests/test_async_filters.py | 67 ++++++++++++++++---- - tests/test_loader.py | 5 +- - 6 files changed, 214 insertions(+), 63 deletions(-) - -diff --git a/src/jinja2/async_utils.py b/src/jinja2/async_utils.py -index e65219e..b0d277d 100644 ---- a/src/jinja2/async_utils.py -+++ b/src/jinja2/async_utils.py -@@ -6,6 +6,9 @@ from functools import wraps - from .utils import _PassArg - from .utils import pass_eval_context - -+if t.TYPE_CHECKING: -+ import typing_extensions as te -+ - V = t.TypeVar("V") - - -@@ -67,15 +70,27 @@ async def auto_await(value: t.Union[t.Awaitable["V"], "V"]) -> "V": - return t.cast("V", value) - - --async def auto_aiter( -+class _IteratorToAsyncIterator(t.Generic[V]): -+ def __init__(self, iterator: "t.Iterator[V]"): -+ self._iterator = iterator -+ -+ def __aiter__(self) -> "te.Self": -+ return self -+ -+ async def __anext__(self) -> V: -+ try: -+ return next(self._iterator) -+ except StopIteration as e: -+ raise StopAsyncIteration(e.value) from e -+ -+ -+def auto_aiter( - iterable: "t.Union[t.AsyncIterable[V], t.Iterable[V]]", - ) -> "t.AsyncIterator[V]": - if hasattr(iterable, "__aiter__"): -- async for item in t.cast("t.AsyncIterable[V]", iterable): -- yield item -+ return iterable.__aiter__() - else: -- for item in iterable: -- yield item -+ return _IteratorToAsyncIterator(iter(iterable)) - - - async def auto_to_list( -diff --git a/src/jinja2/compiler.py b/src/jinja2/compiler.py -index 2740717..91720c5 100644 ---- a/src/jinja2/compiler.py -+++ b/src/jinja2/compiler.py -@@ -55,7 +55,7 @@ def optimizeconst(f: F) -> F: - - return f(self, node, frame, **kwargs) - -- return update_wrapper(t.cast(F, new_func), f) -+ return update_wrapper(new_func, f) # type: ignore[return-value] - - - def _make_binop(op: str) -> t.Callable[["CodeGenerator", nodes.BinExpr, "Frame"], None]: -@@ -902,12 +902,15 @@ class CodeGenerator(NodeVisitor): - if not self.environment.is_async: - self.writeline("yield from parent_template.root_render_func(context)") - else: -- self.writeline( -- "async for event in parent_template.root_render_func(context):" -- ) -+ self.writeline("agen = parent_template.root_render_func(context)") -+ self.writeline("try:") -+ self.indent() -+ self.writeline("async for event in agen:") - self.indent() - self.writeline("yield event") - self.outdent() -+ self.outdent() -+ self.writeline("finally: await agen.aclose()") - self.outdent(1 + (not self.has_known_extends)) - - # at this point we now have the blocks collected and can visit them too. -@@ -977,14 +980,20 @@ class CodeGenerator(NodeVisitor): - f"yield from context.blocks[{node.name!r}][0]({context})", node - ) - else: -+ self.writeline(f"gen = context.blocks[{node.name!r}][0]({context})") -+ self.writeline("try:") -+ self.indent() - self.writeline( -- f"{self.choose_async()}for event in" -- f" context.blocks[{node.name!r}][0]({context}):", -+ f"{self.choose_async()}for event in gen:", - node, - ) - self.indent() - self.simple_write("event", frame) - self.outdent() -+ self.outdent() -+ self.writeline( -+ f"finally: {self.choose_async('await gen.aclose()', 'gen.close()')}" -+ ) - - self.outdent(level) - -@@ -1057,26 +1066,33 @@ class CodeGenerator(NodeVisitor): - self.writeline("else:") - self.indent() - -- skip_event_yield = False -+ def loop_body() -> None: -+ self.indent() -+ self.simple_write("event", frame) -+ self.outdent() -+ - if node.with_context: - self.writeline( -- f"{self.choose_async()}for event in template.root_render_func(" -+ f"gen = template.root_render_func(" - "template.new_context(context.get_all(), True," -- f" {self.dump_local_context(frame)})):" -+ f" {self.dump_local_context(frame)}))" -+ ) -+ self.writeline("try:") -+ self.indent() -+ self.writeline(f"{self.choose_async()}for event in gen:") -+ loop_body() -+ self.outdent() -+ self.writeline( -+ f"finally: {self.choose_async('await gen.aclose()', 'gen.close()')}" - ) - elif self.environment.is_async: - self.writeline( - "for event in (await template._get_default_module_async())" - "._body_stream:" - ) -+ loop_body() - else: - self.writeline("yield from template._get_default_module()._body_stream") -- skip_event_yield = True -- -- if not skip_event_yield: -- self.indent() -- self.simple_write("event", frame) -- self.outdent() - - if node.ignore_missing: - self.outdent() -diff --git a/src/jinja2/environment.py b/src/jinja2/environment.py -index 1d3be0b..bdd6a2b 100644 ---- a/src/jinja2/environment.py -+++ b/src/jinja2/environment.py -@@ -1358,7 +1358,7 @@ class Template: - - async def generate_async( - self, *args: t.Any, **kwargs: t.Any -- ) -> t.AsyncIterator[str]: -+ ) -> t.AsyncGenerator[str, object]: - """An async version of :meth:`generate`. Works very similarly but - returns an async iterator instead. - """ -@@ -1370,8 +1370,14 @@ class Template: - ctx = self.new_context(dict(*args, **kwargs)) - - try: -- async for event in self.root_render_func(ctx): # type: ignore -- yield event -+ agen = self.root_render_func(ctx) -+ try: -+ async for event in agen: # type: ignore -+ yield event -+ finally: -+ # we can't use async with aclosing(...) because that's only -+ # in 3.10+ -+ await agen.aclose() # type: ignore - except Exception: - yield self.environment.handle_exception() - -diff --git a/tests/test_async.py b/tests/test_async.py -index c9ba70c..4edced9 100644 ---- a/tests/test_async.py -+++ b/tests/test_async.py -@@ -1,6 +1,7 @@ - import asyncio - - import pytest -+import trio - - from jinja2 import ChainableUndefined - from jinja2 import DictLoader -@@ -13,7 +14,16 @@ from jinja2.exceptions import UndefinedError - from jinja2.nativetypes import NativeEnvironment - - --def test_basic_async(): -+def _asyncio_run(async_fn, *args): -+ return asyncio.run(async_fn(*args)) -+ -+ -+@pytest.fixture(params=[_asyncio_run, trio.run], ids=["asyncio", "trio"]) -+def run_async_fn(request): -+ return request.param -+ -+ -+def test_basic_async(run_async_fn): - t = Template( - "{% for item in [1, 2, 3] %}[{{ item }}]{% endfor %}", enable_async=True - ) -@@ -21,11 +31,11 @@ def test_basic_async(): - async def func(): - return await t.render_async() - -- rv = asyncio.run(func()) -+ rv = run_async_fn(func) - assert rv == "[1][2][3]" - - --def test_await_on_calls(): -+def test_await_on_calls(run_async_fn): - t = Template("{{ async_func() + normal_func() }}", enable_async=True) - - async def async_func(): -@@ -37,7 +47,7 @@ def test_await_on_calls(): - async def func(): - return await t.render_async(async_func=async_func, normal_func=normal_func) - -- rv = asyncio.run(func()) -+ rv = run_async_fn(func) - assert rv == "65" - - -@@ -54,7 +64,7 @@ def test_await_on_calls_normal_render(): - assert rv == "65" - - --def test_await_and_macros(): -+def test_await_and_macros(run_async_fn): - t = Template( - "{% macro foo(x) %}[{{ x }}][{{ async_func() }}]{% endmacro %}{{ foo(42) }}", - enable_async=True, -@@ -66,11 +76,11 @@ def test_await_and_macros(): - async def func(): - return await t.render_async(async_func=async_func) - -- rv = asyncio.run(func()) -+ rv = run_async_fn(func) - assert rv == "[42][42]" - - --def test_async_blocks(): -+def test_async_blocks(run_async_fn): - t = Template( - "{% block foo %}{% endblock %}{{ self.foo() }}", - enable_async=True, -@@ -80,7 +90,7 @@ def test_async_blocks(): - async def func(): - return await t.render_async() - -- rv = asyncio.run(func()) -+ rv = run_async_fn(func) - assert rv == "" - - -@@ -156,8 +166,8 @@ class TestAsyncImports: - test_env_async.from_string('{% from "foo" import bar, with, context %}') - test_env_async.from_string('{% from "foo" import bar, with with context %}') - -- def test_exports(self, test_env_async): -- coro = test_env_async.from_string( -+ def test_exports(self, test_env_async, run_async_fn): -+ coro_fn = test_env_async.from_string( - """ - {% macro toplevel() %}...{% endmacro %} - {% macro __private() %}...{% endmacro %} -@@ -166,9 +176,9 @@ class TestAsyncImports: - {% macro notthere() %}{% endmacro %} - {% endfor %} - """ -- )._get_default_module_async() -- m = asyncio.run(coro) -- assert asyncio.run(m.toplevel()) == "..." -+ )._get_default_module_async -+ m = run_async_fn(coro_fn) -+ assert run_async_fn(m.toplevel) == "..." - assert not hasattr(m, "__missing") - assert m.variable == 42 - assert not hasattr(m, "notthere") -@@ -457,17 +467,19 @@ class TestAsyncForLoop: - ) - assert tmpl.render(items=reversed([3, 2, 1])) == "1,2,3" - -- def test_loop_errors(self, test_env_async): -+ def test_loop_errors(self, test_env_async, run_async_fn): - tmpl = test_env_async.from_string( - """{% for item in [1] if loop.index - == 0 %}...{% endfor %}""" - ) -- pytest.raises(UndefinedError, tmpl.render) -+ with pytest.raises(UndefinedError): -+ run_async_fn(tmpl.render_async) -+ - tmpl = test_env_async.from_string( - """{% for item in [] %}...{% else - %}{{ loop }}{% endfor %}""" - ) -- assert tmpl.render() == "" -+ assert run_async_fn(tmpl.render_async) == "" - - def test_loop_filter(self, test_env_async): - tmpl = test_env_async.from_string( -@@ -597,7 +609,7 @@ class TestAsyncForLoop: - assert t.render(a=dict(b=[1, 2, 3])) == "1" - - --def test_namespace_awaitable(test_env_async): -+def test_namespace_awaitable(test_env_async, run_async_fn): - async def _test(): - t = test_env_async.from_string( - '{% set ns = namespace(foo="Bar") %}{{ ns.foo }}' -@@ -605,10 +617,10 @@ def test_namespace_awaitable(test_env_async): - actual = await t.render_async() - assert actual == "Bar" - -- asyncio.run(_test()) -+ run_async_fn(_test) - - --def test_chainable_undefined_aiter(): -+def test_chainable_undefined_aiter(run_async_fn): - async def _test(): - t = Template( - "{% for x in a['b']['c'] %}{{ x }}{% endfor %}", -@@ -618,7 +630,7 @@ def test_chainable_undefined_aiter(): - rv = await t.render_async(a={}) - assert rv == "" - -- asyncio.run(_test()) -+ run_async_fn(_test) - - - @pytest.fixture -@@ -626,22 +638,22 @@ def async_native_env(): - return NativeEnvironment(enable_async=True) - - --def test_native_async(async_native_env): -+def test_native_async(async_native_env, run_async_fn): - async def _test(): - t = async_native_env.from_string("{{ x }}") - rv = await t.render_async(x=23) - assert rv == 23 - -- asyncio.run(_test()) -+ run_async_fn(_test) - - --def test_native_list_async(async_native_env): -+def test_native_list_async(async_native_env, run_async_fn): - async def _test(): - t = async_native_env.from_string("{{ x }}") - rv = await t.render_async(x=list(range(3))) - assert rv == [0, 1, 2] - -- asyncio.run(_test()) -+ run_async_fn(_test) - - - def test_getitem_after_filter(): -@@ -658,3 +670,65 @@ def test_getitem_after_call(): - t = env.from_string("{{ add_each(a, 2)[1:] }}") - out = t.render(a=range(3)) - assert out == "[3, 4]" -+ -+ -+def test_basic_generate_async(run_async_fn): -+ t = Template( -+ "{% for item in [1, 2, 3] %}[{{ item }}]{% endfor %}", enable_async=True -+ ) -+ -+ async def func(): -+ agen = t.generate_async() -+ try: -+ return await agen.__anext__() -+ finally: -+ await agen.aclose() -+ -+ rv = run_async_fn(func) -+ assert rv == "[" -+ -+ -+def test_include_generate_async(run_async_fn, test_env_async): -+ t = test_env_async.from_string('{% include "header" %}') -+ -+ async def func(): -+ agen = t.generate_async() -+ try: -+ return await agen.__anext__() -+ finally: -+ await agen.aclose() -+ -+ rv = run_async_fn(func) -+ assert rv == "[" -+ -+ -+def test_blocks_generate_async(run_async_fn): -+ t = Template( -+ "{% block foo %}{% endblock %}{{ self.foo() }}", -+ enable_async=True, -+ autoescape=True, -+ ) -+ -+ async def func(): -+ agen = t.generate_async() -+ try: -+ return await agen.__anext__() -+ finally: -+ await agen.aclose() -+ -+ rv = run_async_fn(func) -+ assert rv == "" -+ -+ -+def test_async_extend(run_async_fn, test_env_async): -+ t = test_env_async.from_string('{% extends "header" %}') -+ -+ async def func(): -+ agen = t.generate_async() -+ try: -+ return await agen.__anext__() -+ finally: -+ await agen.aclose() -+ -+ rv = run_async_fn(func) -+ assert rv == "[" -diff --git a/tests/test_async_filters.py b/tests/test_async_filters.py -index f5b2627..e8cc350 100644 ---- a/tests/test_async_filters.py -+++ b/tests/test_async_filters.py -@@ -1,6 +1,9 @@ -+import asyncio -+import contextlib - from collections import namedtuple - - import pytest -+import trio - from markupsafe import Markup - - from jinja2 import Environment -@@ -26,10 +29,39 @@ def env_async(): - return Environment(enable_async=True) - - -+def _asyncio_run(async_fn, *args): -+ return asyncio.run(async_fn(*args)) -+ -+ -+@pytest.fixture(params=[_asyncio_run, trio.run], ids=["asyncio", "trio"]) -+def run_async_fn(request): -+ return request.param -+ -+ -+@contextlib.asynccontextmanager -+async def closing_factory(): -+ async with contextlib.AsyncExitStack() as stack: -+ -+ def closing(maybe_agen): -+ try: -+ aclose = maybe_agen.aclose -+ except AttributeError: -+ pass -+ else: -+ stack.push_async_callback(aclose) -+ return maybe_agen -+ -+ yield closing -+ -+ - @mark_dualiter("foo", lambda: range(10)) --def test_first(env_async, foo): -- tmpl = env_async.from_string("{{ foo()|first }}") -- out = tmpl.render(foo=foo) -+def test_first(env_async, foo, run_async_fn): -+ async def test(): -+ async with closing_factory() as closing: -+ tmpl = env_async.from_string("{{ closing(foo())|first }}") -+ return await tmpl.render_async(foo=foo, closing=closing) -+ -+ out = run_async_fn(test) - assert out == "0" - - -@@ -245,18 +277,23 @@ def test_slice(env_async, items): - ) - - --def test_custom_async_filter(env_async): -+def test_custom_async_filter(env_async, run_async_fn): - async def customfilter(val): - return str(val) - -- env_async.filters["customfilter"] = customfilter -- tmpl = env_async.from_string("{{ 'static'|customfilter }} {{ arg|customfilter }}") -- out = tmpl.render(arg="dynamic") -+ async def test(): -+ env_async.filters["customfilter"] = customfilter -+ tmpl = env_async.from_string( -+ "{{ 'static'|customfilter }} {{ arg|customfilter }}" -+ ) -+ return await tmpl.render_async(arg="dynamic") -+ -+ out = run_async_fn(test) - assert out == "static dynamic" - - - @mark_dualiter("items", lambda: range(10)) --def test_custom_async_iteratable_filter(env_async, items): -+def test_custom_async_iteratable_filter(env_async, items, run_async_fn): - async def customfilter(iterable): - items = [] - async for item in auto_aiter(iterable): -@@ -265,9 +302,13 @@ def test_custom_async_iteratable_filter(env_async, items): - break - return ",".join(items) - -- env_async.filters["customfilter"] = customfilter -- tmpl = env_async.from_string( -- "{{ items()|customfilter }} .. {{ [3, 4, 5, 6]|customfilter }}" -- ) -- out = tmpl.render(items=items) -+ async def test(): -+ async with closing_factory() as closing: -+ env_async.filters["customfilter"] = customfilter -+ tmpl = env_async.from_string( -+ "{{ closing(items())|customfilter }} .. {{ [3, 4, 5, 6]|customfilter }}" -+ ) -+ return await tmpl.render_async(items=items, closing=closing) -+ -+ out = run_async_fn(test) - assert out == "0,1,2 .. 3,4,5" -diff --git a/tests/test_loader.py b/tests/test_loader.py -index 77d686e..3e64f62 100644 ---- a/tests/test_loader.py -+++ b/tests/test_loader.py -@@ -2,7 +2,6 @@ import importlib.abc - import importlib.machinery - import importlib.util - import os --import platform - import shutil - import sys - import tempfile -@@ -364,8 +363,8 @@ def test_package_zip_source(package_zip_loader, template, expect): - - - @pytest.mark.xfail( -- platform.python_implementation() == "PyPy", -- reason="PyPy's zipimporter doesn't have a '_files' attribute.", -+ sys.implementation.name == "pypy" or sys.version_info > (3, 13), -+ reason="zipimporter doesn't have a '_files' attribute", - raises=TypeError, - ) - def test_package_zip_list(package_zip_loader): --- -2.45.0 - diff --git a/sources b/sources index 04e4371..bcd8583 100644 --- a/sources +++ b/sources @@ -1 +1 @@ -SHA512 (jinja2-3.1.4.tar.gz) = d07d68a2687af68c705d3b7f5a2c67aca7b9d125316b15085888b9d0d6e769981af76f6f524728b89b5501bd671d518fcb2638f9ae112e57ca2bf2a53482cd89 +SHA512 (jinja2-3.1.5.tar.gz) = 75ad0094482c69d45fcd3aa8ee32e249931e53fee3f804f6ddfd5b6da0ed16962d8f1fced811e7dcb4d8401fadd828e77528d6d1280547a7d4f5f77cccf9bbd4 From e78f795e7e1dbde1e05377a3e36bca78efa7542c Mon Sep 17 00:00:00 2001 From: Fedora Release Engineering Date: Sat, 18 Jan 2025 15:24:14 +0000 Subject: [PATCH 46/53] Rebuilt for https://fedoraproject.org/wiki/Fedora_42_Mass_Rebuild --- python-jinja2.spec | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/python-jinja2.spec b/python-jinja2.spec index a5b4dd1..66f1903 100644 --- a/python-jinja2.spec +++ b/python-jinja2.spec @@ -2,7 +2,7 @@ Name: python-jinja2 Version: 3.1.5 -Release: 1%{?dist} +Release: 2%{?dist} Summary: General purpose template engine License: BSD-3-Clause URL: https://palletsprojects.com/p/jinja/ @@ -89,6 +89,9 @@ rm -rvf docs/_build/html/.buildinfo %changelog +* Sat Jan 18 2025 Fedora Release Engineering - 3.1.5-2 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_42_Mass_Rebuild + * Wed Jan 08 2025 Miro Hrončok - 3.1.5-1 - Update to 3.1.5 - Security fix for CVE-2024-56201 From ab04c1a35a443a58bd6ea6f1cd19c2f2d2c90e72 Mon Sep 17 00:00:00 2001 From: Thomas Moschny Date: Sun, 9 Mar 2025 17:46:42 +0100 Subject: [PATCH 47/53] Update to 3.1.6. --- .gitignore | 3 +-- python-jinja2.spec | 7 +++++-- sources | 2 +- 3 files changed, 7 insertions(+), 5 deletions(-) diff --git a/.gitignore b/.gitignore index 38359a3..e0fc652 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,2 @@ /Jinja2-*.tar.gz -/jinja2-3.1.4.tar.gz -/jinja2-3.1.5.tar.gz +/jinja2-*.tar.gz diff --git a/python-jinja2.spec b/python-jinja2.spec index 66f1903..bf54187 100644 --- a/python-jinja2.spec +++ b/python-jinja2.spec @@ -1,8 +1,8 @@ %global srcname jinja2 Name: python-jinja2 -Version: 3.1.5 -Release: 2%{?dist} +Version: 3.1.6 +Release: 1%{?dist} Summary: General purpose template engine License: BSD-3-Clause URL: https://palletsprojects.com/p/jinja/ @@ -89,6 +89,9 @@ rm -rvf docs/_build/html/.buildinfo %changelog +* Sun Mar 9 2025 Thomas Moschny - 3.1.6-1 +- Update to 3.1.6. + * Sat Jan 18 2025 Fedora Release Engineering - 3.1.5-2 - Rebuilt for https://fedoraproject.org/wiki/Fedora_42_Mass_Rebuild diff --git a/sources b/sources index bcd8583..17e3310 100644 --- a/sources +++ b/sources @@ -1 +1 @@ -SHA512 (jinja2-3.1.5.tar.gz) = 75ad0094482c69d45fcd3aa8ee32e249931e53fee3f804f6ddfd5b6da0ed16962d8f1fced811e7dcb4d8401fadd828e77528d6d1280547a7d4f5f77cccf9bbd4 +SHA512 (jinja2-3.1.6.tar.gz) = bddd5e142f1462426c57b2efafdfafdfc6b66de257668707940896feae71eabdf19e0b6e34ef49b965153baf9b1eb59bb5a97349bb287ea0921dd2a751e967ab From 9a3178e4bafd414d1081c46466a6fb5fc2de1f91 Mon Sep 17 00:00:00 2001 From: Lumir Balhar Date: Thu, 27 Mar 2025 12:32:17 +0100 Subject: [PATCH 48/53] Skip flaky test_elif_deep https://github.com/pallets/jinja/issues/2079 --- python-jinja2.spec | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/python-jinja2.spec b/python-jinja2.spec index bf54187..d1f3d1c 100644 --- a/python-jinja2.spec +++ b/python-jinja2.spec @@ -76,7 +76,9 @@ rm -rvf docs/_build/html/.buildinfo %check -%pytest tests %{!?with_asyncio_tests:--ignore tests/test_async.py --ignore tests/test_async_filters.py} +# test_elif_deep is flaky for an unknown reason +# https://github.com/pallets/jinja/issues/2079 +%pytest tests -k "not test_elif_deep" %{!?with_asyncio_tests:--ignore tests/test_async.py --ignore tests/test_async_filters.py} %files -n python3-jinja2 -f %{pyproject_files} From 811a737fb9ce918be6741e18ffb6552948cfa61e Mon Sep 17 00:00:00 2001 From: Python Maint Date: Mon, 2 Jun 2025 23:22:52 +0200 Subject: [PATCH 49/53] Bootstrap for Python 3.14 --- python-jinja2.spec | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/python-jinja2.spec b/python-jinja2.spec index d1f3d1c..e24ca87 100644 --- a/python-jinja2.spec +++ b/python-jinja2.spec @@ -1,8 +1,10 @@ +%global _without_asyncio_tests 1 +%global _without_docs 1 %global srcname jinja2 Name: python-jinja2 Version: 3.1.6 -Release: 1%{?dist} +Release: 2%{?dist} Summary: General purpose template engine License: BSD-3-Clause URL: https://palletsprojects.com/p/jinja/ @@ -91,6 +93,9 @@ rm -rvf docs/_build/html/.buildinfo %changelog +* Mon Jun 02 2025 Python Maint - 3.1.6-2 +- Bootstrap for Python 3.14 + * Sun Mar 9 2025 Thomas Moschny - 3.1.6-1 - Update to 3.1.6. From 159d32e14344130cfa4ebd149a179cf296318510 Mon Sep 17 00:00:00 2001 From: Python Maint Date: Tue, 3 Jun 2025 15:55:25 +0200 Subject: [PATCH 50/53] Rebuilt for Python 3.14 --- python-jinja2.spec | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/python-jinja2.spec b/python-jinja2.spec index e24ca87..2dea906 100644 --- a/python-jinja2.spec +++ b/python-jinja2.spec @@ -1,10 +1,8 @@ -%global _without_asyncio_tests 1 -%global _without_docs 1 %global srcname jinja2 Name: python-jinja2 Version: 3.1.6 -Release: 2%{?dist} +Release: 3%{?dist} Summary: General purpose template engine License: BSD-3-Clause URL: https://palletsprojects.com/p/jinja/ @@ -93,6 +91,9 @@ rm -rvf docs/_build/html/.buildinfo %changelog +* Tue Jun 03 2025 Python Maint - 3.1.6-3 +- Rebuilt for Python 3.14 + * Mon Jun 02 2025 Python Maint - 3.1.6-2 - Bootstrap for Python 3.14 From 3fcf5e155d46fdda3f86a3933374327cb059dc33 Mon Sep 17 00:00:00 2001 From: Fedora Release Engineering Date: Fri, 25 Jul 2025 08:27:59 +0000 Subject: [PATCH 51/53] Rebuilt for https://fedoraproject.org/wiki/Fedora_43_Mass_Rebuild --- python-jinja2.spec | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/python-jinja2.spec b/python-jinja2.spec index 2dea906..752e703 100644 --- a/python-jinja2.spec +++ b/python-jinja2.spec @@ -2,7 +2,7 @@ Name: python-jinja2 Version: 3.1.6 -Release: 3%{?dist} +Release: 4%{?dist} Summary: General purpose template engine License: BSD-3-Clause URL: https://palletsprojects.com/p/jinja/ @@ -91,6 +91,9 @@ rm -rvf docs/_build/html/.buildinfo %changelog +* Fri Jul 25 2025 Fedora Release Engineering - 3.1.6-4 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_43_Mass_Rebuild + * Tue Jun 03 2025 Python Maint - 3.1.6-3 - Rebuilt for Python 3.14 From da96094071355fb759336154757e42f60eeb5181 Mon Sep 17 00:00:00 2001 From: Python Maint Date: Fri, 15 Aug 2025 13:58:35 +0200 Subject: [PATCH 52/53] Rebuilt for Python 3.14.0rc2 bytecode --- python-jinja2.spec | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/python-jinja2.spec b/python-jinja2.spec index 752e703..28f26f9 100644 --- a/python-jinja2.spec +++ b/python-jinja2.spec @@ -2,7 +2,7 @@ Name: python-jinja2 Version: 3.1.6 -Release: 4%{?dist} +Release: 5%{?dist} Summary: General purpose template engine License: BSD-3-Clause URL: https://palletsprojects.com/p/jinja/ @@ -91,6 +91,9 @@ rm -rvf docs/_build/html/.buildinfo %changelog +* Fri Aug 15 2025 Python Maint - 3.1.6-5 +- Rebuilt for Python 3.14.0rc2 bytecode + * Fri Jul 25 2025 Fedora Release Engineering - 3.1.6-4 - Rebuilt for https://fedoraproject.org/wiki/Fedora_43_Mass_Rebuild From 73b8db5fe8682a25bd1b2ab9e6c6131f1c37463a Mon Sep 17 00:00:00 2001 From: Python Maint Date: Fri, 19 Sep 2025 13:31:55 +0200 Subject: [PATCH 53/53] Rebuilt for Python 3.14.0rc3 bytecode --- python-jinja2.spec | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/python-jinja2.spec b/python-jinja2.spec index 28f26f9..410f2c0 100644 --- a/python-jinja2.spec +++ b/python-jinja2.spec @@ -2,7 +2,7 @@ Name: python-jinja2 Version: 3.1.6 -Release: 5%{?dist} +Release: 6%{?dist} Summary: General purpose template engine License: BSD-3-Clause URL: https://palletsprojects.com/p/jinja/ @@ -91,6 +91,9 @@ rm -rvf docs/_build/html/.buildinfo %changelog +* Fri Sep 19 2025 Python Maint - 3.1.6-6 +- Rebuilt for Python 3.14.0rc3 bytecode + * Fri Aug 15 2025 Python Maint - 3.1.6-5 - Rebuilt for Python 3.14.0rc2 bytecode