diff --git a/python-Genshi.changes b/python-Genshi.changes index beaf6f7..99d2e3a 100644 --- a/python-Genshi.changes +++ b/python-Genshi.changes @@ -1,3 +1,10 @@ +------------------------------------------------------------------- +Tue Aug 7 07:48:29 UTC 2018 - tchvatal@suse.com + +- Add patches to build on python 3.7: + * python-genshi-py3-escape-sequence-doctest.patch + * python-genshi-py37-stopiteration.patch + ------------------------------------------------------------------- Tue Apr 6 17:08:45 UTC 2017 - jmatejek@suse.com diff --git a/python-Genshi.spec b/python-Genshi.spec index c0d3337..7de3909 100644 --- a/python-Genshi.spec +++ b/python-Genshi.spec @@ -1,7 +1,7 @@ # # spec file for package python-Genshi # -# Copyright (c) 2017 SUSE LINUX GmbH, Nuernberg, Germany. +# Copyright (c) 2018 SUSE LINUX GmbH, Nuernberg, Germany. # # All modifications and additions to the file contributed by third parties # remain the property of their copyright owners, unless otherwise agreed @@ -17,13 +17,14 @@ %{?!python_module:%define python_module() python-%{**} python3-%{**}} +%define oldpython python Name: python-Genshi Version: 0.7 Release: 0 -Url: http://genshi.edgewall.org/ Summary: A toolkit for generation of output for the web License: BSD-3-Clause Group: Development/Languages/Python +URL: http://genshi.edgewall.org/ Source: https://files.pythonhosted.org/packages/source/G/Genshi/Genshi-%{version}.tar.gz # PATCH-FIX-UPSTREAM http://genshi.edgewall.org/ticket/566 Patch1: changeset_r1242.diff @@ -39,6 +40,9 @@ Patch5: %{name}-0.7-python34-ast-support.patch Patch6: %{name}-bug-602-python35-support.patch # PATCH-FIX-UPSTREAM python-Genshi-python35-support-python27-fix.patch http://genshi.edgewall.org/ticket/602 Patch7: %{name}-bug-602-python35-support-python27-fix.patch +# PATCH-FIX-UPSTREAM build for python3.7 +Patch8: python-genshi-py3-escape-sequence-doctest.patch +Patch9: python-genshi-py37-stopiteration.patch BuildRequires: %{python_module Babel} BuildRequires: %{python_module devel} BuildRequires: %{python_module setuptools} @@ -48,12 +52,10 @@ BuildRequires: gcc BuildRequires: python-rpm-macros Requires: python-Babel Requires: python-xml -%define oldpython python %ifpython2 Obsoletes: %{oldpython}-genshi < %{version} Provides: %{oldpython}-genshi = %{version} %endif -BuildRoot: %{_tmppath}/%{name}-%{version}-build %python_subpackages %description @@ -63,7 +65,6 @@ other textual content for output generation on the web. The major feature is a template language, which is heavily inspired by Kid. %package -n %{name}-doc - Summary: A toolkit for generation of output for the web - Documentation Group: Development/Libraries/Python Requires: %{name} = %{version} @@ -87,6 +88,8 @@ This package contains documentation and examples. %patch5 %patch6 -p1 %patch7 -p1 +%patch8 -p1 +%patch9 -p1 sed -i "1d" examples/{basic/run,basic/kidrun,tutorial/geddit/controller}.py # Fix non-excutable bits %fdupes -s doc pushd examples/bench/clearsilver @@ -109,13 +112,12 @@ rm -f %{buildroot}%{$python_sitearch}/genshi/_speedups.c %python_exec setup.py test %files %{python_files} -%defattr(-,root,root,-) -%doc COPYING ChangeLog README.txt +%license COPYING +%doc ChangeLog README.txt %{python_sitearch}/genshi/ %{python_sitearch}/Genshi-%{version}-py%{python_version}.egg-info %files -n %{name}-doc -%defattr(-,root,root,-) %doc doc examples %changelog diff --git a/python-genshi-py3-escape-sequence-doctest.patch b/python-genshi-py3-escape-sequence-doctest.patch new file mode 100644 index 0000000..2ca8388 --- /dev/null +++ b/python-genshi-py3-escape-sequence-doctest.patch @@ -0,0 +1,32 @@ +From 7891f1dc0a35a1c790a20b73c8d4c84ed12c1077 Mon Sep 17 00:00:00 2001 +From: Felix Schwarz +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 ... :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 + diff --git a/python-genshi-py37-stopiteration.patch b/python-genshi-py37-stopiteration.patch new file mode 100644 index 0000000..ab8530b --- /dev/null +++ b/python-genshi-py37-stopiteration.patch @@ -0,0 +1,47 @@ +From 6fed7cdbf1b9f35fa085e22fc0d87d0614625313 Mon Sep 17 00:00:00 2001 +From: Felix Schwarz +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 +