From 5d68afcb6b634107b0a56bda46dd354467458c56 Mon Sep 17 00:00:00 2001 From: root Date: Wed, 24 Jun 2020 17:34:49 +0800 Subject: [PATCH] fix the tests error --- fix-the-ImportManger-infinite-recursion.patch | 22 +++++++++ fix-the-regressions-test-error.patch | 45 +++++++++++++++++++ python-cheetah.spec | 7 ++- 3 files changed, 73 insertions(+), 1 deletion(-) create mode 100644 fix-the-ImportManger-infinite-recursion.patch create mode 100644 fix-the-regressions-test-error.patch diff --git a/fix-the-ImportManger-infinite-recursion.patch b/fix-the-ImportManger-infinite-recursion.patch new file mode 100644 index 0000000..5121cc0 --- /dev/null +++ b/fix-the-ImportManger-infinite-recursion.patch @@ -0,0 +1,22 @@ +From 18219344a05a2db8aaa39f401567d18b9ffd57c6 Mon Sep 17 00:00:00 2001 +Subject: fix the ImportManger infinite recursion + +--- + Cheetah/ImportManager.py | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/Cheetah/ImportManager.py b/Cheetah/ImportManager.py +index dbb2c96..d752755 100644 +--- a/Cheetah/ImportManager.py ++++ b/Cheetah/ImportManager.py +@@ -21,6 +21,7 @@ import sys + import imp + import marshal + from Cheetah.compat import string_type ++import _bootlocale + + _installed = False + +-- +2.23.0 + diff --git a/fix-the-regressions-test-error.patch b/fix-the-regressions-test-error.patch new file mode 100644 index 0000000..1b4c646 --- /dev/null +++ b/fix-the-regressions-test-error.patch @@ -0,0 +1,45 @@ +From 43de6576d55bfcbdbc51e065f5df78fb8da83023 Mon Sep 17 00:00:00 2001 +From: Oleg Broytman +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() diff --git a/python-cheetah.spec b/python-cheetah.spec index 1352369..284d45c 100644 --- a/python-cheetah.spec +++ b/python-cheetah.spec @@ -1,6 +1,6 @@ Name: python-cheetah Version: 3.1.0 -Release: 7 +Release: 8 Summary: The Python-Powered Template Engine License: MIT URL: http://cheetahtemplate.org/ @@ -9,6 +9,8 @@ BuildRequires: gcc python2-devel python2-setuptools python2-markdown python2-py BuildRequires: python3-devel python3-setuptools python3-markdown python3-pygments Patch0001: cheetah-3.0.0-dont-run-tests-twice.patch +Patch0002: fix-the-regressions-test-error.patch +Patch0003: fix-the-ImportManger-infinite-recursion.patch %description Cheetah3 is a free and open source template engine and code-generation tool written in Python. @@ -65,5 +67,8 @@ export PATH="%{buildroot}/%{_bindir}:$PATH" PYTHONPATH="%{buildroot}/%{python3_s %{python3_sitearch}/ %changelog +* Wed Jun 24 2020 wangchong - 3.1.0-8 +- fix the tests error + * Wed Jan 8 2020 liujing - 3.1.0-7 - Package init