Compare commits

...

10 Commits

Author SHA1 Message Date
openeuler-ci-bot
c2e6306ade
!11 provide python3dist(cheetah3) to be compatible with older versions
From: @caodongxia 
Reviewed-by: @overweight 
Signed-off-by: @overweight
2023-05-26 02:34:45 +00:00
caodongxia
ec5a64d8ca provide python3dist(cheetah3) to be compatible with older versions 2023-05-25 14:05:43 +08:00
openeuler-ci-bot
f702df1af5
!10 升级python-cheetah到3.3.1版本
From: @huangduirong 
Reviewed-by: @licihua 
Signed-off-by: @licihua
2023-02-18 09:34:40 +00:00
huangduirong
8a08446919 upgrage cheetah to 3.3.1 2023-02-18 04:19:16 -05:00
openeuler-ci-bot
fcbae68db2
!7 Upgrade to 3.2.6
From: @houyingchao 
Reviewed-by: @licihua 
Signed-off-by: @licihua
2022-06-15 07:45:23 +00:00
houyingchao
261d9646be Upgrade to 3.2.6 2022-06-15 15:12:03 +08:00
openeuler-ci-bot
5d2ca31969
!6 解决master工程python-cheetah的importerror
From: @xigaoxinyan 
Reviewed-by: @overweight 
Signed-off-by: @overweight
2022-04-12 03:07:20 +00:00
xigaoxinyan
43bbbc1a71 spec 2022-04-12 10:38:33 +08:00
openeuler-ci-bot
b777b9192a !5 Remove subpackage python2-cheetah
From: @lei_ju
Reviewed-by: @xiezhipeng1
Signed-off-by: @xiezhipeng1
2020-10-30 16:00:32 +08:00
lei_ju
0c07031073 Remove subpackage python2-cheetah 2020-10-30 14:26:09 +08:00
9 changed files with 103 additions and 105 deletions

BIN
3.3.1.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,22 +0,0 @@
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

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

@ -0,0 +1,27 @@
From d4f4de215094dc9c1f51427f3d24f66739115470 Mon Sep 17 00:00:00 2001
From: houyingchao <1348375921@qq.com>
Date: Wed, 15 Jun 2022 14:04:57 +0800
Subject: [PATCH] import-from-the-new-abc-module
---
Cheetah/NameMapper.py | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/Cheetah/NameMapper.py b/Cheetah/NameMapper.py
index 3c16dff..d92cddd 100755
--- a/Cheetah/NameMapper.py
+++ b/Cheetah/NameMapper.py
@@ -140,6 +140,10 @@ Cheetah uses the optimized C version (_namemapper.c) if it has
been compiled or falls back to the Python version if not.
"""
+try:
+ from collections.abc import Mapping
+except ImportError:
+ from collections import Mapping
import inspect
from pprint import pformat
--
2.23.0

View File

@ -1,16 +1,13 @@
Name: python-cheetah
Version: 3.1.0
Release: 8
Version: 3.3.1
Release: 2
Summary: The Python-Powered Template Engine
License: MIT
URL: http://cheetahtemplate.org/
Source: https://pypi.python.org/packages/54/86/ea50bb5baf1daa8ca1a56774d48150a69376679d27c4130848702efc378c/Cheetah3-3.1.0.tar.gz
BuildRequires: gcc python2-devel python2-setuptools python2-markdown python2-pygments
BuildRequires: python3-devel python3-setuptools python3-markdown python3-pygments
Source0: https://github.com/CheetahTemplate3/cheetah3/archive/refs/tags/3.3.1.tar.gz
BuildRequires: gcc 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
Patch0001: resolve-run-test-Wrong-argument.patch
%description
Cheetah3 is a free and open source template engine and code-generation tool written in Python.
@ -20,46 +17,29 @@ At its core, Cheetah is a domain-specific language for markup generation and tem
which allows for full integration with existing Python code but also offers extensions
to traditional Python syntax to allow for easier text-generation.
%package -n python2-cheetah
Summary: The Python-Powered Template Engine
%{?python_provide:%python_provide python2-cheetah}
%description -n python2-cheetah
The Python-Powered Template Engine
%package -n python3-cheetah
Summary: The Python-Powered Template Engine
%{?python_provide:%python_provide python3-cheetah}
Provides: python%{python3_pkgversion}dist(cheetah3) = %{version}
Provides: python%{python3_version}dist(cheetah3) = %{version}
%description -n python3-cheetah
The Python-Powered Template Engine
%prep
%autosetup -n Cheetah3-%{version} -p1
%{__sed} -i -e '/^#!/,1d' Cheetah/Tests/* Cheetah/DirectiveAnalyzer.py Cheetah/Utils/Misc.py
%autosetup -n cheetah3-%{version} -p1
%{__sed} -i -e '/^#!/,1d' Cheetah/Tests/*.py Cheetah/DirectiveAnalyzer.py Cheetah/Utils/Misc.py
%build
%py2_build
%py3_build
%install
%py2_install
EGG_INFO=(%{buildroot}/%{python2_sitearch}/Cheetah*.egg-info)
cp -r $EGG_INFO ${EGG_INFO//Cheetah3/Cheetah}
sed -i "s/Name: Cheetah3/Name: Cheetah/" ${EGG_INFO//Cheetah3/Cheetah}/PKG-INFO
%py3_install
%check
export PATH="%{buildroot}/%{_bindir}:$PATH" PYTHONPATH="%{buildroot}/%{python3_sitearch}"
%{buildroot}/%{_bindir}/cheetah test
%files -n python2-cheetah
%license LICENSE
%doc ANNOUNCE.rst README.rst TODO BUGS
%{python2_sitearch}/
%files -n python3-cheetah
%license LICENSE
%doc ANNOUNCE.rst README.rst TODO BUGS
@ -67,6 +47,21 @@ export PATH="%{buildroot}/%{_bindir}:$PATH" PYTHONPATH="%{buildroot}/%{python3_s
%{python3_sitearch}/
%changelog
* Thu May 25 2023 caodongxia <caodongxia@h-partners.com> - 3.3.1-2
- Provide python3dist(cheetah3) to be compatible with older versions
* Sat Feb 18 2023 huangduirong <huangduirong@huawei.com> - 3.3.1-1
- Upgrade to version 3.3.1
* 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
- import from the new abc module inside of collections
* Wed Oct 21 2020 chengzihan <chengzihan2@huawei.com> - 3.1.0-9
- Remove subpackage python2-cheetah
* Wed Jun 24 2020 wangchong <wangchong56@huawei.com> - 3.1.0-8
- fix the tests error

View File

@ -0,0 +1,25 @@
From d06581d7ecd75a97221f48aa2d0639772f171c0e Mon Sep 17 00:00:00 2001
From: huangduirong <huangduirong@huawei.com>
Date: Sat, 18 Feb 2023 04:12:19 -0500
Subject: [PATCH] resolve run test Wrong argument
---
Cheetah/Tests/Test.py | 2 ++
1 file changed, 2 insertions(+)
diff --git a/Cheetah/Tests/Test.py b/Cheetah/Tests/Test.py
index a3dfd41..08e79d4 100755
--- a/Cheetah/Tests/Test.py
+++ b/Cheetah/Tests/Test.py
@@ -16,6 +16,8 @@ import sys
args_l = len(sys.argv)
if args_l == 1:
pass
+elif args_l == 2 and sys.argv[1] == 'test':
+ pass
elif args_l == 2 and sys.argv[1] == '--namemapper-pure':
try:
from Cheetah import _namemapper # noqa
--
2.35.1