Compare commits
10 Commits
d5894c09ad
...
ae73038733
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
ae73038733 | ||
|
|
8854d673b0 | ||
|
|
d59bed2160 | ||
|
|
14a6c76ec1 | ||
|
|
38aceb570b | ||
|
|
2c0aae3b7c | ||
|
|
4550f77475 | ||
|
|
681e3f138d | ||
|
|
b2b80325f6 | ||
|
|
52652abb48 |
BIN
Genshi-0.7.7.tar.gz
Normal file
BIN
Genshi-0.7.7.tar.gz
Normal file
Binary file not shown.
Binary file not shown.
37
backport-0001-Fix-installation-with-setuptools-60.patch
Normal file
37
backport-0001-Fix-installation-with-setuptools-60.patch
Normal file
@ -0,0 +1,37 @@
|
|||||||
|
From 0850374ad9b83e1057ba67c7f9bf73dd13038df3 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Graham Inggs <ginggs@debian.org>
|
||||||
|
Date: Thu, 27 Oct 2022 12:58:29 +0200
|
||||||
|
Subject: [PATCH] Fix installation with setuptools >= 60
|
||||||
|
|
||||||
|
Installation of genshi with recent versions of setuptools fails with:
|
||||||
|
`distutils.errors.DistutilsSetupError: each element of 'ext_modules' option must be an Extension instance or 2-tuple`
|
||||||
|
Setuptools monkeypatches distutils, so change the ordering of imports so that setuptools is imported before distutils.
|
||||||
|
---
|
||||||
|
setup.py | 4 ++--
|
||||||
|
1 file changed, 2 insertions(+), 2 deletions(-)
|
||||||
|
|
||||||
|
diff --git a/setup.py b/setup.py
|
||||||
|
index c14cfa8..b5eb7a3 100755
|
||||||
|
--- a/setup.py
|
||||||
|
+++ b/setup.py
|
||||||
|
@@ -12,8 +12,6 @@
|
||||||
|
# individuals. For the exact contribution history, see the revision
|
||||||
|
# history and logs, available at http://genshi.edgewall.org/log/.
|
||||||
|
|
||||||
|
-from distutils.command.build_ext import build_ext
|
||||||
|
-from distutils.errors import CCompilerError, DistutilsPlatformError
|
||||||
|
import os
|
||||||
|
try:
|
||||||
|
from setuptools import setup, Extension
|
||||||
|
@@ -21,6 +19,8 @@ try:
|
||||||
|
except ImportError:
|
||||||
|
from distutils.core import setup, Extension
|
||||||
|
bdist_egg = None
|
||||||
|
+from distutils.command.build_ext import build_ext
|
||||||
|
+from distutils.errors import CCompilerError, DistutilsPlatformError
|
||||||
|
import sys
|
||||||
|
|
||||||
|
sys.path.append(os.path.join('doc', 'common'))
|
||||||
|
--
|
||||||
|
2.39.0.windows.2
|
||||||
|
|
||||||
@ -1,24 +0,0 @@
|
|||||||
------------------------------------------------------------------------
|
|
||||||
r1247 | hodgestar | 2014-02-16 19:32:21 +0100 (So, 16. Feb 2014) | 1 Zeile
|
|
||||||
|
|
||||||
Disable the speedups C extension on CPython >= 3.3 since Genshi doesn't support the new Unicode C API yet.
|
|
||||||
------------------------------------------------------------------------
|
|
||||||
Index: setup.py
|
|
||||||
===================================================================
|
|
||||||
--- a/setup.py (Revision 1246)
|
|
||||||
+++ b/setup.py (Revision 1247)
|
|
||||||
@@ -65,9 +65,13 @@
|
|
||||||
|
|
||||||
|
|
||||||
if Feature:
|
|
||||||
+ # Optional C extension module for speeding up Genshi:
|
|
||||||
+ # Not activated by default on:
|
|
||||||
+ # - PyPy (where it harms performance)
|
|
||||||
+ # - CPython >= 3.3 (the new Unicode C API is not supported yet)
|
|
||||||
speedups = Feature(
|
|
||||||
"optional C speed-enhancements",
|
|
||||||
- standard = not is_pypy,
|
|
||||||
+ standard = not is_pypy and sys.version_info < (3, 3),
|
|
||||||
ext_modules = [
|
|
||||||
Extension('genshi._speedups', ['genshi/_speedups.c']),
|
|
||||||
],
|
|
||||||
@ -1,30 +0,0 @@
|
|||||||
------------------------------------------------------------------------
|
|
||||||
r1248 | hodgestar | 2014-02-16 19:43:20 +0100 (So, 16. Feb 2014) | 1 Zeile
|
|
||||||
|
|
||||||
Add isstring helper.
|
|
||||||
------------------------------------------------------------------------
|
|
||||||
Index: genshi/compat.py
|
|
||||||
===================================================================
|
|
||||||
--- a/genshi/compat.py (Revision 1247)
|
|
||||||
+++ b/genshi/compat.py (Revision 1248)
|
|
||||||
@@ -35,6 +35,15 @@
|
|
||||||
'Python 2 compatibility function. Not usable in Python 3.')
|
|
||||||
|
|
||||||
|
|
||||||
+# We need to test if an object is an instance of a string type in places
|
|
||||||
+
|
|
||||||
+if IS_PYTHON2:
|
|
||||||
+ def isstring(obj):
|
|
||||||
+ return isinstance(obj, basestring)
|
|
||||||
+else:
|
|
||||||
+ def isstring(obj):
|
|
||||||
+ return isinstance(obj, str)
|
|
||||||
+
|
|
||||||
# We need to differentiate between StringIO and BytesIO in places
|
|
||||||
|
|
||||||
if IS_PYTHON2:
|
|
||||||
@@ -112,4 +121,3 @@
|
|
||||||
if not x:
|
|
||||||
return False
|
|
||||||
return True
|
|
||||||
-
|
|
||||||
@ -1,142 +0,0 @@
|
|||||||
------------------------------------------------------------------------
|
|
||||||
r1249 | hodgestar | 2014-02-16 19:46:15 +0100 (So, 16. Feb 2014) | 1 Zeile
|
|
||||||
|
|
||||||
Add support for Python 3.4 AST (support for NameConstants and changes to existing to arguments node attributes).
|
|
||||||
------------------------------------------------------------------------
|
|
||||||
Index: genshi/template/astutil.py
|
|
||||||
===================================================================
|
|
||||||
--- a/genshi/template/astutil.py (Revision 1248)
|
|
||||||
+++ b/genshi/template/astutil.py (Revision 1249)
|
|
||||||
@@ -21,7 +21,7 @@
|
|
||||||
def parse(source, mode):
|
|
||||||
return compile(source, '', mode, _ast.PyCF_ONLY_AST)
|
|
||||||
|
|
||||||
-from genshi.compat import IS_PYTHON2
|
|
||||||
+from genshi.compat import IS_PYTHON2, isstring
|
|
||||||
|
|
||||||
__docformat__ = 'restructuredtext en'
|
|
||||||
|
|
||||||
@@ -103,8 +103,13 @@
|
|
||||||
self._new_line()
|
|
||||||
return self.visit(node.body)
|
|
||||||
|
|
||||||
+ # Python < 3.4
|
|
||||||
# arguments = (expr* args, identifier? vararg,
|
|
||||||
# identifier? kwarg, expr* defaults)
|
|
||||||
+ #
|
|
||||||
+ # Python >= 3.4
|
|
||||||
+ # arguments = (arg* args, arg? vararg, arg* kwonlyargs, expr* kw_defaults,
|
|
||||||
+ # arg? kwarg, expr* defaults)
|
|
||||||
def visit_arguments(self, node):
|
|
||||||
first = True
|
|
||||||
no_default_count = len(node.args) - len(node.defaults)
|
|
||||||
@@ -122,13 +127,21 @@
|
|
||||||
self._write(', ')
|
|
||||||
else:
|
|
||||||
first = False
|
|
||||||
- self._write('*' + node.vararg)
|
|
||||||
+ self._write('*')
|
|
||||||
+ if isstring(node.vararg):
|
|
||||||
+ self._write(node.vararg)
|
|
||||||
+ else:
|
|
||||||
+ self.visit(node.vararg)
|
|
||||||
if getattr(node, 'kwarg', None):
|
|
||||||
if not first:
|
|
||||||
self._write(', ')
|
|
||||||
else:
|
|
||||||
first = False
|
|
||||||
- self._write('**' + node.kwarg)
|
|
||||||
+ self._write('**')
|
|
||||||
+ if isstring(node.kwarg):
|
|
||||||
+ self._write(node.kwarg)
|
|
||||||
+ else:
|
|
||||||
+ self.visit(node.kwarg)
|
|
||||||
|
|
||||||
if not IS_PYTHON2:
|
|
||||||
# In Python 3 arguments get a special node
|
|
||||||
@@ -724,6 +737,17 @@
|
|
||||||
def visit_Name(self, node):
|
|
||||||
self._write(node.id)
|
|
||||||
|
|
||||||
+ # NameConstant(singleton value)
|
|
||||||
+ def visit_NameConstant(self, node):
|
|
||||||
+ if node.value is None:
|
|
||||||
+ self._write('None')
|
|
||||||
+ elif node.value is True:
|
|
||||||
+ self._write('True')
|
|
||||||
+ elif node.value is False:
|
|
||||||
+ self._write('False')
|
|
||||||
+ else:
|
|
||||||
+ raise Exception("Unknown NameConstant %r" % (node.value,))
|
|
||||||
+
|
|
||||||
# List(expr* elts, expr_context ctx)
|
|
||||||
def visit_List(self, node):
|
|
||||||
self._write('[')
|
|
||||||
@@ -829,6 +853,7 @@
|
|
||||||
visit_Attribute = _clone
|
|
||||||
visit_Subscript = _clone
|
|
||||||
visit_Name = _clone
|
|
||||||
+ visit_NameConstant = _clone
|
|
||||||
visit_List = _clone
|
|
||||||
visit_Tuple = _clone
|
|
||||||
|
|
||||||
Index: genshi/template/eval.py
|
|
||||||
===================================================================
|
|
||||||
--- a/genshi/template/eval.py (Revision 1248)
|
|
||||||
+++ b/genshi/template/eval.py (Revision 1249)
|
|
||||||
@@ -24,7 +24,8 @@
|
|
||||||
from genshi.template.base import TemplateRuntimeError
|
|
||||||
from genshi.util import flatten
|
|
||||||
|
|
||||||
-from genshi.compat import get_code_params, build_code_chunk, IS_PYTHON2
|
|
||||||
+from genshi.compat import get_code_params, build_code_chunk, isstring, \
|
|
||||||
+ IS_PYTHON2
|
|
||||||
|
|
||||||
__all__ = ['Code', 'Expression', 'Suite', 'LenientLookup', 'StrictLookup',
|
|
||||||
'Undefined', 'UndefinedError']
|
|
||||||
@@ -495,28 +496,31 @@
|
|
||||||
def __init__(self):
|
|
||||||
self.locals = [CONSTANTS]
|
|
||||||
|
|
||||||
+ def _process(self, names, node):
|
|
||||||
+ if not IS_PYTHON2 and isinstance(node, _ast.arg):
|
|
||||||
+ names.add(node.arg)
|
|
||||||
+ elif isstring(node):
|
|
||||||
+ names.add(node)
|
|
||||||
+ elif isinstance(node, _ast.Name):
|
|
||||||
+ names.add(node.id)
|
|
||||||
+ elif isinstance(node, _ast.alias):
|
|
||||||
+ names.add(node.asname or node.name)
|
|
||||||
+ elif isinstance(node, _ast.Tuple):
|
|
||||||
+ for elt in node.elts:
|
|
||||||
+ self._process(names, elt)
|
|
||||||
+
|
|
||||||
def _extract_names(self, node):
|
|
||||||
names = set()
|
|
||||||
- def _process(node):
|
|
||||||
- if not IS_PYTHON2 and isinstance(node, _ast.arg):
|
|
||||||
- names.add(node.arg)
|
|
||||||
- if isinstance(node, _ast.Name):
|
|
||||||
- names.add(node.id)
|
|
||||||
- elif isinstance(node, _ast.alias):
|
|
||||||
- names.add(node.asname or node.name)
|
|
||||||
- elif isinstance(node, _ast.Tuple):
|
|
||||||
- for elt in node.elts:
|
|
||||||
- _process(elt)
|
|
||||||
if hasattr(node, 'args'):
|
|
||||||
for arg in node.args:
|
|
||||||
- _process(arg)
|
|
||||||
+ self._process(names, arg)
|
|
||||||
if hasattr(node, 'vararg'):
|
|
||||||
- names.add(node.vararg)
|
|
||||||
+ self._process(names, node.vararg)
|
|
||||||
if hasattr(node, 'kwarg'):
|
|
||||||
- names.add(node.kwarg)
|
|
||||||
+ self._process(names, node.kwarg)
|
|
||||||
elif hasattr(node, 'names'):
|
|
||||||
for elt in node.names:
|
|
||||||
- _process(elt)
|
|
||||||
+ self._process(names, elt)
|
|
||||||
return names
|
|
||||||
|
|
||||||
def visit_Str(self, node):
|
|
||||||
@ -1,43 +0,0 @@
|
|||||||
------------------------------------------------------------------------
|
|
||||||
r1246 | hodgestar | 2014-02-16 19:25:17 +0100 (So, 16. Feb 2014) | 1 Zeile
|
|
||||||
|
|
||||||
Also allow stripping of unsafe script tags (Python 3.4 parses the second example as a tag whose name is script&xyz).
|
|
||||||
------------------------------------------------------------------------
|
|
||||||
Index: genshi/filters/tests/test_html.py
|
|
||||||
===================================================================
|
|
||||||
--- a/genshi/filters/tests/test_html.py (Revision 1245)
|
|
||||||
+++ b/genshi/filters/tests/test_html.py (Revision 1246)
|
|
||||||
@@ -368,12 +368,16 @@
|
|
||||||
|
|
||||||
class HTMLSanitizerTestCase(unittest.TestCase):
|
|
||||||
|
|
||||||
- def assert_parse_error_or_equal(self, expected, exploit):
|
|
||||||
+ def assert_parse_error_or_equal(self, expected, exploit,
|
|
||||||
+ allow_strip=False):
|
|
||||||
try:
|
|
||||||
html = HTML(exploit)
|
|
||||||
except ParseError:
|
|
||||||
return
|
|
||||||
- self.assertEquals(expected, (html | HTMLSanitizer()).render())
|
|
||||||
+ sanitized_html = (html | HTMLSanitizer()).render()
|
|
||||||
+ if not sanitized_html and allow_strip:
|
|
||||||
+ return
|
|
||||||
+ self.assertEquals(expected, sanitized_html)
|
|
||||||
|
|
||||||
def test_sanitize_unchanged(self):
|
|
||||||
html = HTML(u'<a href="#">fo<br />o</a>')
|
|
||||||
@@ -416,10 +420,12 @@
|
|
||||||
html = HTML(u'<SCRIPT SRC="http://example.com/"></SCRIPT>')
|
|
||||||
self.assertEquals('', (html | HTMLSanitizer()).render())
|
|
||||||
src = u'<SCR\0IPT>alert("foo")</SCR\0IPT>'
|
|
||||||
- self.assert_parse_error_or_equal('<SCR\x00IPT>alert("foo")', src)
|
|
||||||
+ self.assert_parse_error_or_equal('<SCR\x00IPT>alert("foo")', src,
|
|
||||||
+ allow_strip=True)
|
|
||||||
src = u'<SCRIPT&XYZ SRC="http://example.com/"></SCRIPT>'
|
|
||||||
self.assert_parse_error_or_equal('<SCRIPT&XYZ; '
|
|
||||||
- 'SRC="http://example.com/">', src)
|
|
||||||
+ 'SRC="http://example.com/">', src,
|
|
||||||
+ allow_strip=True)
|
|
||||||
|
|
||||||
def test_sanitize_remove_onclick_attr(self):
|
|
||||||
html = HTML(u'<div onclick=\'alert("foo")\' />')
|
|
||||||
@ -1,15 +0,0 @@
|
|||||||
http://genshi.edgewall.org/ticket/602#comment:2
|
|
||||||
|
|
||||||
diff --git a/genshi/template/directives.py b/genshi/template/directives.py
|
|
||||||
index 6fd0f28..1f70ef6 100644
|
|
||||||
--- a/genshi/template/directives.py
|
|
||||||
+++ b/genshi/template/directives.py
|
|
||||||
@@ -266,7 +266,7 @@ class DefDirective(Directive):
|
|
||||||
if isinstance(ast, _ast.Call):
|
|
||||||
self.name = ast.func.id
|
|
||||||
for arg in ast.args:
|
|
||||||
- if isinstance(arg, _ast.Starred):
|
|
||||||
+ if hasattr(_ast, 'Starred') and isinstance(arg, _ast.Starred):
|
|
||||||
# Python 3.5+
|
|
||||||
self.star_args = arg.value.id
|
|
||||||
else:
|
|
||||||
@ -1,100 +0,0 @@
|
|||||||
Patch from Tim Hatch
|
|
||||||
http://genshi.edgewall.org/ticket/602
|
|
||||||
|
|
||||||
diff --git a/genshi/filters/i18n.py b/genshi/filters/i18n.py
|
|
||||||
index b724956..dfb52b8 100644
|
|
||||||
--- a/genshi/filters/i18n.py
|
|
||||||
+++ b/genshi/filters/i18n.py
|
|
||||||
@@ -1187,8 +1187,10 @@ def extract_from_code(code, gettext_functions):
|
|
||||||
elif arg:
|
|
||||||
strings.append(None)
|
|
||||||
[_add(arg) for arg in node.args]
|
|
||||||
- _add(node.starargs)
|
|
||||||
- _add(node.kwargs)
|
|
||||||
+ if hasattr(node, 'starargs'):
|
|
||||||
+ _add(node.starargs)
|
|
||||||
+ if hasattr(node, 'kwargs'):
|
|
||||||
+ _add(node.kwargs)
|
|
||||||
if len(strings) == 1:
|
|
||||||
strings = strings[0]
|
|
||||||
else:
|
|
||||||
diff --git a/genshi/template/astutil.py b/genshi/template/astutil.py
|
|
||||||
index a3946b4..07edc92 100644
|
|
||||||
--- a/genshi/template/astutil.py
|
|
||||||
+++ b/genshi/template/astutil.py
|
|
||||||
@@ -148,6 +148,10 @@ class ASTCodeGenerator(object):
|
|
||||||
def visit_arg(self, node):
|
|
||||||
self._write(node.arg)
|
|
||||||
|
|
||||||
+ def visit_Starred(self, node):
|
|
||||||
+ self._write('*')
|
|
||||||
+ self.visit(node.value)
|
|
||||||
+
|
|
||||||
# FunctionDef(identifier name, arguments args,
|
|
||||||
# stmt* body, expr* decorator_list)
|
|
||||||
def visit_FunctionDef(self, node):
|
|
||||||
@@ -661,9 +665,13 @@ class ASTCodeGenerator(object):
|
|
||||||
if not first:
|
|
||||||
self._write(', ')
|
|
||||||
first = False
|
|
||||||
- # keyword = (identifier arg, expr value)
|
|
||||||
- self._write(keyword.arg)
|
|
||||||
- self._write('=')
|
|
||||||
+ if not keyword.arg:
|
|
||||||
+ # Python 3.5+ star-star args
|
|
||||||
+ self._write('**')
|
|
||||||
+ else:
|
|
||||||
+ # keyword = (identifier arg, expr value)
|
|
||||||
+ self._write(keyword.arg)
|
|
||||||
+ self._write('=')
|
|
||||||
self.visit(keyword.value)
|
|
||||||
if getattr(node, 'starargs', None):
|
|
||||||
if not first:
|
|
||||||
diff --git a/genshi/template/directives.py b/genshi/template/directives.py
|
|
||||||
index 7301c2d..6fd0f28 100644
|
|
||||||
--- a/genshi/template/directives.py
|
|
||||||
+++ b/genshi/template/directives.py
|
|
||||||
@@ -266,13 +266,21 @@ class DefDirective(Directive):
|
|
||||||
if isinstance(ast, _ast.Call):
|
|
||||||
self.name = ast.func.id
|
|
||||||
for arg in ast.args:
|
|
||||||
- # only names
|
|
||||||
- self.args.append(arg.id)
|
|
||||||
+ if isinstance(arg, _ast.Starred):
|
|
||||||
+ # Python 3.5+
|
|
||||||
+ self.star_args = arg.value.id
|
|
||||||
+ else:
|
|
||||||
+ # only names
|
|
||||||
+ self.args.append(arg.id)
|
|
||||||
for kwd in ast.keywords:
|
|
||||||
- self.args.append(kwd.arg)
|
|
||||||
- exp = Expression(kwd.value, template.filepath,
|
|
||||||
- lineno, lookup=template.lookup)
|
|
||||||
- self.defaults[kwd.arg] = exp
|
|
||||||
+ if kwd.arg is None:
|
|
||||||
+ # Python 3.5+
|
|
||||||
+ self.dstar_args = kwd.value.id
|
|
||||||
+ else:
|
|
||||||
+ self.args.append(kwd.arg)
|
|
||||||
+ exp = Expression(kwd.value, template.filepath,
|
|
||||||
+ lineno, lookup=template.lookup)
|
|
||||||
+ self.defaults[kwd.arg] = exp
|
|
||||||
if getattr(ast, 'starargs', None):
|
|
||||||
self.star_args = ast.starargs.id
|
|
||||||
if getattr(ast, 'kwargs', None):
|
|
||||||
diff --git a/genshi/template/eval.py b/genshi/template/eval.py
|
|
||||||
index de4bc86..065c0c7 100644
|
|
||||||
--- a/genshi/template/eval.py
|
|
||||||
+++ b/genshi/template/eval.py
|
|
||||||
@@ -597,6 +597,11 @@ class TemplateASTTransformer(ASTTransformer):
|
|
||||||
finally:
|
|
||||||
self.locals.pop()
|
|
||||||
|
|
||||||
+ # Only used in Python 3.5+
|
|
||||||
+ def visit_Starred(self, node):
|
|
||||||
+ node.value = self.visit(node.value)
|
|
||||||
+ return node
|
|
||||||
+
|
|
||||||
def visit_Name(self, node):
|
|
||||||
# If the name refers to a local inside a lambda, list comprehension, or
|
|
||||||
# generator expression, leave it alone
|
|
||||||
@ -1,32 +0,0 @@
|
|||||||
From 7891f1dc0a35a1c790a20b73c8d4c84ed12c1077 Mon Sep 17 00:00:00 2001
|
|
||||||
From: Felix Schwarz <felix.schwarz@oss.schwarz.eu>
|
|
||||||
Date: Fri, 29 Jun 2018 09:01:09 +0200
|
|
||||||
Subject: [PATCH] prevent deprecation warning due to invalid escape sequence in
|
|
||||||
NewTextTemplate doc test
|
|
||||||
|
|
||||||
Previously the running the test suite triggered a deprecation warning:
|
|
||||||
|
|
||||||
NewTextTemplate (genshi.template.text)
|
|
||||||
Doctest: genshi.template.text.NewTextTemplate ... <doctest genshi.template.text.NewTextTemplate[4]>:8: DeprecationWarning: invalid escape sequence \{
|
|
||||||
''')
|
|
||||||
ok
|
|
||||||
---
|
|
||||||
genshi/template/text.py | 2 +-
|
|
||||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
|
||||||
|
|
||||||
diff --git a/genshi/template/text.py b/genshi/template/text.py
|
|
||||||
index e2342c7..15e3bbd 100644
|
|
||||||
--- a/genshi/template/text.py
|
|
||||||
+++ b/genshi/template/text.py
|
|
||||||
@@ -100,7 +100,7 @@ class NewTextTemplate(Template):
|
|
||||||
|
|
||||||
>>> tmpl = NewTextTemplate('''Dear $name,
|
|
||||||
...
|
|
||||||
- ... \{# This is a comment #}
|
|
||||||
+ ... \\{# This is a comment #}
|
|
||||||
... We have the following items for you:
|
|
||||||
... {% for item in items %}\
|
|
||||||
... * $item
|
|
||||||
--
|
|
||||||
2.17.1
|
|
||||||
|
|
||||||
@ -1,47 +0,0 @@
|
|||||||
From 6fed7cdbf1b9f35fa085e22fc0d87d0614625313 Mon Sep 17 00:00:00 2001
|
|
||||||
From: Felix Schwarz <felix.schwarz@oss.schwarz.eu>
|
|
||||||
Date: Fri, 29 Jun 2018 08:58:18 +0200
|
|
||||||
Subject: [PATCH 1/2] catch StopIteration and use plain "return" (Python 3.7
|
|
||||||
compatibility)
|
|
||||||
|
|
||||||
In Python 3.7 StopIteration exceptions are transformed to RuntimeErrors (PEP 479).
|
|
||||||
|
|
||||||
Probably we need to do this in more places but this gets the test suite passing
|
|
||||||
at least.
|
|
||||||
---
|
|
||||||
genshi/core.py | 5 ++++-
|
|
||||||
genshi/filters/transform.py | 2 +-
|
|
||||||
2 files changed, 5 insertions(+), 2 deletions(-)
|
|
||||||
|
|
||||||
diff --git a/genshi/core.py b/genshi/core.py
|
|
||||||
index 8c4c93d..d0e8ff6 100644
|
|
||||||
--- a/genshi/core.py
|
|
||||||
+++ b/genshi/core.py
|
|
||||||
@@ -270,7 +270,10 @@ COMMENT = Stream.COMMENT
|
|
||||||
def _ensure(stream):
|
|
||||||
"""Ensure that every item on the stream is actually a markup event."""
|
|
||||||
stream = iter(stream)
|
|
||||||
- event = stream.next()
|
|
||||||
+ try:
|
|
||||||
+ event = stream.next()
|
|
||||||
+ except StopIteration:
|
|
||||||
+ return
|
|
||||||
|
|
||||||
# Check whether the iterable is a real markup event stream by examining the
|
|
||||||
# first item it yields; if it's not we'll need to do some conversion
|
|
||||||
diff --git a/genshi/filters/transform.py b/genshi/filters/transform.py
|
|
||||||
index 569fc05..d7475db 100644
|
|
||||||
--- a/genshi/filters/transform.py
|
|
||||||
+++ b/genshi/filters/transform.py
|
|
||||||
@@ -119,7 +119,7 @@ class PushBackStream(object):
|
|
||||||
yield event
|
|
||||||
except StopIteration:
|
|
||||||
if self.peek is None:
|
|
||||||
- raise
|
|
||||||
+ return
|
|
||||||
|
|
||||||
|
|
||||||
class Transformer(object):
|
|
||||||
--
|
|
||||||
2.17.1
|
|
||||||
|
|
||||||
@ -1,85 +1,98 @@
|
|||||||
Name: python-genshi
|
%global _empty_manifest_terminate_build 0
|
||||||
Version: 0.7
|
Name: python-genshi
|
||||||
Release: 23
|
Version: 0.7.7
|
||||||
Summary: Python toolkit for generation of output for the web
|
Release: 2
|
||||||
License: BSD
|
Summary: Toolkit for stream-based generation of output for the web
|
||||||
URL: http://genshi.edgewall.org/
|
License: BSD-3-Clause
|
||||||
Source0: http://ftp.edgewall.com/pub/genshi/Genshi-%{version}.tar.gz
|
URL: http://genshi.edgewall.org/
|
||||||
Patch0000: python-genshi-0.7-sanitizer-test-fixes.patch
|
Source0: https://files.pythonhosted.org/packages/d5/13/bdb68fb9652bb145c341756fbe9563a270fd385ff11410837b59d98ab178/Genshi-0.7.7.tar.gz
|
||||||
Patch0001: python-genshi-0.7-disable-speedups-for-python34.patch
|
|
||||||
Patch0002: python-genshi-0.7-isstring-helper.patch
|
|
||||||
Patch0003: python-genshi-0.7-python34-ast-support.patch
|
|
||||||
Patch0004: python-genshi-bug-602-python35-support.patch
|
|
||||||
Patch0005: python-genshi-bug-602-python35-support-python27-fix.patch
|
|
||||||
Patch0006: python-genshi-py37-stopiteration.patch
|
|
||||||
Patch0007: python-genshi-py3-escape-sequence-doctest.patch
|
|
||||||
|
|
||||||
BuildRequires: gcc python2-devel python2-setuptools python3-devel python3-setuptools
|
Requires: python3-babel >= 0.8
|
||||||
Requires: python2-babel >= 0.8
|
|
||||||
|
Patch0001: backport-0001-Fix-installation-with-setuptools-60.patch
|
||||||
|
|
||||||
%description
|
%description
|
||||||
Genshi is a Python library that provides an integrated set of components
|
Genshi is a Python library that provides an integrated set of
|
||||||
for parsing, generating, and processing HTML, XML
|
components for parsing, generating, and processing HTML, XML
|
||||||
or other textual content for output generation on the web.
|
|
||||||
|
|
||||||
%package -n python2-genshi
|
|
||||||
Summary: Python toolkit for generation of output for the web
|
|
||||||
%{?python_provide:%python_provide python2-genshi}
|
|
||||||
|
|
||||||
%description -n python2-genshi
|
|
||||||
Genshi is a Python library that provides an integrated set of components
|
|
||||||
for parsing, generating, and processing HTML, XML
|
|
||||||
or other textual content for output generation on the web.
|
or other textual content for output generation on the web.
|
||||||
|
|
||||||
%package -n python3-genshi
|
%package -n python3-genshi
|
||||||
Summary: Python toolkit for generation of output for the web
|
Summary: Toolkit for stream-based generation of output for the web
|
||||||
%{?python_provide:%python_provide python3-genshi}
|
Provides: python-genshi = %{version}-%{release}
|
||||||
BuildArch: noarch
|
BuildRequires: python3-devel
|
||||||
Requires: python3-babel >= 0.8
|
BuildRequires: python3-setuptools
|
||||||
|
BuildRequires: python3-six
|
||||||
%description -n python3-genshi
|
%description -n python3-genshi
|
||||||
Genshi is a Python library that provides an integrated set of components
|
Genshi is a Python library that provides an integrated set of
|
||||||
for parsing, generating, and processing HTML, XML
|
components for parsing, generating, and processing HTML, XML
|
||||||
|
or other textual content for output generation on the web.
|
||||||
|
|
||||||
|
%package help
|
||||||
|
Summary: Development documents and examples for Genshi
|
||||||
|
Provides: python3-genshi-doc
|
||||||
|
%description help
|
||||||
|
Genshi is a Python library that provides an integrated set of
|
||||||
|
components for parsing, generating, and processing HTML, XML
|
||||||
or other textual content for output generation on the web.
|
or other textual content for output generation on the web.
|
||||||
|
|
||||||
%prep
|
%prep
|
||||||
%autosetup -n Genshi-%{version} -p1
|
%autosetup -n Genshi-%{version}
|
||||||
|
|
||||||
rm -rf %{modname}.egg-info
|
|
||||||
rm -rf %{py3dir}
|
|
||||||
cp -a . %{py3dir}
|
|
||||||
|
|
||||||
chmod a-x examples/*
|
|
||||||
|
|
||||||
%build
|
%build
|
||||||
%{__python2} setup.py build
|
%py3_build
|
||||||
|
|
||||||
cd %{py3dir}
|
|
||||||
%{__python3} setup.py build
|
|
||||||
cd -
|
|
||||||
|
|
||||||
%install
|
%install
|
||||||
%{__python2} setup.py install -O1 --skip-build --root %{buildroot}
|
%py3_install
|
||||||
cd %{py3dir}
|
install -d -m755 %{buildroot}/%{_pkgdocdir}
|
||||||
%{__python3} setup.py install -O1 --skip-build --root %{buildroot}
|
if [ -d doc ]; then cp -arf doc %{buildroot}/%{_pkgdocdir}; fi
|
||||||
cd -
|
if [ -d docs ]; then cp -arf docs %{buildroot}/%{_pkgdocdir}; fi
|
||||||
|
if [ -d example ]; then cp -arf example %{buildroot}/%{_pkgdocdir}; fi
|
||||||
|
if [ -d examples ]; then cp -arf examples %{buildroot}/%{_pkgdocdir}; fi
|
||||||
|
pushd %{buildroot}
|
||||||
|
if [ -d usr/lib ]; then
|
||||||
|
find usr/lib -type f -printf "/%h/%f\n" >> filelist.lst
|
||||||
|
fi
|
||||||
|
if [ -d usr/lib64 ]; then
|
||||||
|
find usr/lib64 -type f -printf "/%h/%f\n" >> filelist.lst
|
||||||
|
fi
|
||||||
|
if [ -d usr/bin ]; then
|
||||||
|
find usr/bin -type f -printf "/%h/%f\n" >> filelist.lst
|
||||||
|
fi
|
||||||
|
if [ -d usr/sbin ]; then
|
||||||
|
find usr/sbin -type f -printf "/%h/%f\n" >> filelist.lst
|
||||||
|
fi
|
||||||
|
touch doclist.lst
|
||||||
|
if [ -d usr/share/man ]; then
|
||||||
|
find usr/share/man -type f -printf "/%h/%f.gz\n" >> doclist.lst
|
||||||
|
fi
|
||||||
|
popd
|
||||||
|
mv %{buildroot}/filelist.lst .
|
||||||
|
mv %{buildroot}/doclist.lst .
|
||||||
|
|
||||||
%check
|
%check
|
||||||
%{__python2} setup.py test
|
|
||||||
cd %{py3dir}
|
|
||||||
%{__python3} setup.py test
|
%{__python3} setup.py test
|
||||||
cd -
|
|
||||||
|
|
||||||
%files -n python2-genshi
|
%files -n python3-genshi -f filelist.lst
|
||||||
%doc ChangeLog doc examples README.txt COPYING
|
%dir %{python3_sitearch}/*
|
||||||
%{python2_sitearch}/Genshi-%{version}-py*.egg-info
|
|
||||||
%{python2_sitearch}/genshi
|
|
||||||
|
|
||||||
%files -n python3-genshi
|
%files help -f doclist.lst
|
||||||
%doc ChangeLog doc examples README.txt COPYING
|
%{_docdir}/*
|
||||||
%{python3_sitelib}/Genshi-%{version}-py*.egg-info
|
|
||||||
%{python3_sitelib}/genshi
|
|
||||||
|
|
||||||
%changelog
|
%changelog
|
||||||
|
* Wed Jan 18 2023 yangbo <yangbo1@xfusion.com> - 0.7.7-2
|
||||||
|
- Fix installation with setuptools >= 60
|
||||||
|
|
||||||
|
* Wed Nov 23 2022 liqiuyu <liqiuyu@kylinos.cn> - 0.7.7-1
|
||||||
|
- Update package to version 0.7.7
|
||||||
|
|
||||||
|
* Wed Mar 30 2022 xigaoxinyan <xigaoxinyan@huawei.com> - 0.7.6-1
|
||||||
|
- update to 0.7.6
|
||||||
|
|
||||||
|
* Tue Dec 22 2020 lingsheng <lingsheng@huaweu.com> - 0.7.3-7
|
||||||
|
- Fix wrong source0 url
|
||||||
|
|
||||||
|
* Mon Jun 28 2020 Captain Wei <captain.a.wei@gmail.com> - 0.7.3-6
|
||||||
|
- Upgrade package
|
||||||
|
|
||||||
* Mon Nov 18 2019 openEuler Buildteam <buildteam@openeuler.org> - 0.7-23
|
* Mon Nov 18 2019 openEuler Buildteam <buildteam@openeuler.org> - 0.7-23
|
||||||
- Package init
|
- Package init
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user