Upgrade to 3.2.6

This commit is contained in:
houyingchao 2022-06-15 15:12:03 +08:00
parent 5d2ca31969
commit 261d9646be
7 changed files with 48 additions and 75 deletions

BIN
3.2.6.tar.gz Normal file

Binary file not shown.

Binary file not shown.

27
_bootlocale-removed.patch Normal file
View File

@ -0,0 +1,27 @@
From 112dddd8fa5fb9c285fb8ef2818abfef99365070 Mon Sep 17 00:00:00 2001
From: Victor Stinner <vstinner@python.org>
Date: Tue, 19 Jan 2021 11:19:15 +0100
Subject: [PATCH] Skip test_import_bootlocale() on Python 3.10
The _bootlocale module has been removed from Python 3.10:
https://github.com/python/cpython/commit/b62bdf71ea0cd52041d49691d8ae3dc645bd48e1
https://bugs.python.org/issue42208
---
Cheetah/Tests/ImportHooks.py | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/Cheetah/Tests/ImportHooks.py b/Cheetah/Tests/ImportHooks.py
index d7b5f5d..bc0239c 100644
--- a/Cheetah/Tests/ImportHooks.py
+++ b/Cheetah/Tests/ImportHooks.py
@@ -87,7 +87,9 @@ def test_import_builtin(self):
return
raise self.fail("All builtin modules are imported")
- if not PY2:
+ # _bootlocale was removed in Python 3.10:
+ # https://bugs.python.org/issue42208
+ if not PY2 and sys.version_info < (3, 10):
def test_import_bootlocale(self):
if '_bootlocale' in sys.modules:
del sys.modules['_bootlocale']

View File

@ -1,9 +0,0 @@
--- Cheetah-3.0.0/Cheetah/CheetahWrapper.py.orig 2010-12-12 22:43:26.000000000 -0500
+++ Cheetah-3.0.0/Cheetah/CheetahWrapper.py 2010-12-20 17:24:44.524608918 -0500
@@ -263,7 +263,6 @@
if '-v' in self.testOpts:
verbosity = 2
runner = unittest.TextTestRunner(verbosity=verbosity)
- runner.run(unittest.TestSuite(Test.suites))
results = runner.run(unittest.TestSuite(Test.suites))
exit(int(not results.wasSuccessful()))

View File

@ -1,45 +0,0 @@
From 43de6576d55bfcbdbc51e065f5df78fb8da83023 Mon Sep 17 00:00:00 2001
From: Oleg Broytman <phd@phdru.name>
Date: Sat, 6 Apr 2019 17:25:30 +0300
Subject: [PATCH] Tests: Use `cgi.escape` for Py2, `html.escape` for Py3
---
Cheetah/Tests/Regressions.py | 11 +++++++----
1 files changed, 7 insertions(+), 4 deletions(-)
diff --git a/Cheetah/Tests/Regressions.py b/Cheetah/Tests/Regressions.py
index b380e6d..b72fd77 100755
--- a/Cheetah/Tests/Regressions.py
+++ b/Cheetah/Tests/Regressions.py
@@ -1,5 +1,10 @@
#!/usr/bin/env python
+try:
+ from cgi import escape as html_escape
+except ImportError: # Python 3.8+
+ from html import escape as html_escape
+
import unittest
import Cheetah.NameMapper
import Cheetah.Template
@@ -138,18 +143,16 @@ class Mantis_Issue_11_Regression_Test(unittest.TestCase):
s = s.replace("&", "&") # Must be done first!
'''
def test_FailingBehavior(self):
- import cgi
template = Cheetah.Template.Template(
"$escape($request)",
- searchList=[{'escape': cgi.escape, 'request': 'foobar'}])
+ searchList=[{'escape': html_escape, 'request': 'foobar'}])
assert template
self.assertRaises(AttributeError, template.respond)
def test_FailingBehaviorWithSetting(self):
- import cgi
template = Cheetah.Template.Template(
"$escape($request)",
- searchList=[{'escape': cgi.escape, 'request': 'foobar'}],
+ searchList=[{'escape': html_escape, 'request': 'foobar'}],
compilerSettings={'prioritizeSearchListOverSelf': True})
assert template
assert template.respond()

View File

@ -1,29 +1,27 @@
From 488f246543f8a18ee8ecf8748edec72ade508288 Mon Sep 17 00:00:00 2001 From d4f4de215094dc9c1f51427f3d24f66739115470 Mon Sep 17 00:00:00 2001
From: xigaoxinyan <xigaoxinyan@huawei.com> From: houyingchao <1348375921@qq.com>
Date: Thu, 7 Apr 2022 19:25:39 +0800 Date: Wed, 15 Jun 2022 14:04:57 +0800
Subject: [PATCH] ImportError-py3.10 Subject: [PATCH] import-from-the-new-abc-module
--- ---
NameMapper.py | 6 ++++-- Cheetah/NameMapper.py | 4 ++++
1 file changed, 4 insertions(+), 2 deletions(-) 1 file changed, 4 insertions(+)
diff --git a/NameMapper.py b/NameMapper.py diff --git a/Cheetah/NameMapper.py b/Cheetah/NameMapper.py
index 68ded17..f5207e0 100644 index 3c16dff..d92cddd 100755
--- a/Cheetah/NameMapper.py --- a/Cheetah/NameMapper.py
+++ b/Cheetah/NameMapper.py +++ b/Cheetah/NameMapper.py
@@ -139,8 +139,10 @@ difference in realistic usage scenarios. @@ -140,6 +140,10 @@ Cheetah uses the optimized C version (_namemapper.c) if it has
Cheetah uses the optimized C version (_namemapper.c) if it has
been compiled or falls back to the Python version if not. been compiled or falls back to the Python version if not.
""" """
-
-from collections import Mapping
+try: +try:
+ from collections.abc import Mapping + from collections.abc import Mapping
+except ImportError: +except ImportError:
+ from collections import Mapping + from collections import Mapping
import inspect import inspect
from pprint import pformat from pprint import pformat
from Cheetah.compat import PY2
-- --
2.27.0 2.23.0

View File

@ -1,14 +1,13 @@
Name: python-cheetah Name: python-cheetah
Version: 3.1.0 Version: 3.2.6
Release: 10 Release: 1
Summary: The Python-Powered Template Engine Summary: The Python-Powered Template Engine
License: MIT License: MIT
URL: http://cheetahtemplate.org/ URL: http://cheetahtemplate.org/
Source: https://pypi.python.org/packages/54/86/ea50bb5baf1daa8ca1a56774d48150a69376679d27c4130848702efc378c/Cheetah3-3.1.0.tar.gz Source0: https://github.com/CheetahTemplate3/cheetah3/archive/refs/tags/3.2.6.tar.gz
BuildRequires: gcc python3-devel python3-setuptools python3-markdown python3-pygments BuildRequires: gcc python3-devel python3-setuptools python3-markdown python3-pygments
Patch0001: cheetah-3.0.0-dont-run-tests-twice.patch Patch0001: _bootlocale-removed.patch
Patch0002: fix-the-regressions-test-error.patch
Patch0003: import-from-the-new-abc-module.patch Patch0003: import-from-the-new-abc-module.patch
%description %description
@ -27,8 +26,8 @@ Summary: The Python-Powered Template Engine
The Python-Powered Template Engine The Python-Powered Template Engine
%prep %prep
%autosetup -n Cheetah3-%{version} -p1 %autosetup -n cheetah3-%{version} -p1
%{__sed} -i -e '/^#!/,1d' Cheetah/Tests/* Cheetah/DirectiveAnalyzer.py Cheetah/Utils/Misc.py %{__sed} -i -e '/^#!/,1d' Cheetah/Tests/*.py Cheetah/DirectiveAnalyzer.py Cheetah/Utils/Misc.py
%build %build
%py3_build %py3_build
@ -47,6 +46,9 @@ export PATH="%{buildroot}/%{_bindir}:$PATH" PYTHONPATH="%{buildroot}/%{python3_s
%{python3_sitearch}/ %{python3_sitearch}/
%changelog %changelog
* Wed Jun 15 2022 houyingchao <houyingchao@h-partners.com> - 3.2.6-1
- Upgrade to version 3.2.6
* Tue Apr 12 2022 xigaoxinyan <xigaoxinyan@h-partners.com> - 3.1.0-10 * Tue Apr 12 2022 xigaoxinyan <xigaoxinyan@h-partners.com> - 3.1.0-10
- import from the new abc module inside of collections - import from the new abc module inside of collections