Accepting request 627811 from devel:languages:python

- Add patches to build on python 3.7:
  * python-genshi-py3-escape-sequence-doctest.patch
  * python-genshi-py37-stopiteration.patch

OBS-URL: https://build.opensuse.org/request/show/627811
OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/python-Genshi?expand=0&rev=13
This commit is contained in:
Dominique Leuenberger 2018-08-15 08:32:06 +00:00 committed by Git OBS Bridge
commit 2caebed7a9
4 changed files with 96 additions and 8 deletions

View File

@ -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 Tue Apr 6 17:08:45 UTC 2017 - jmatejek@suse.com

View File

@ -1,7 +1,7 @@
# #
# spec file for package python-Genshi # 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 # All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed # remain the property of their copyright owners, unless otherwise agreed
@ -17,13 +17,14 @@
%{?!python_module:%define python_module() python-%{**} python3-%{**}} %{?!python_module:%define python_module() python-%{**} python3-%{**}}
%define oldpython python
Name: python-Genshi Name: python-Genshi
Version: 0.7 Version: 0.7
Release: 0 Release: 0
Url: http://genshi.edgewall.org/
Summary: A toolkit for generation of output for the web Summary: A toolkit for generation of output for the web
License: BSD-3-Clause License: BSD-3-Clause
Group: Development/Languages/Python Group: Development/Languages/Python
URL: http://genshi.edgewall.org/
Source: https://files.pythonhosted.org/packages/source/G/Genshi/Genshi-%{version}.tar.gz Source: https://files.pythonhosted.org/packages/source/G/Genshi/Genshi-%{version}.tar.gz
# PATCH-FIX-UPSTREAM http://genshi.edgewall.org/ticket/566 # PATCH-FIX-UPSTREAM http://genshi.edgewall.org/ticket/566
Patch1: changeset_r1242.diff Patch1: changeset_r1242.diff
@ -39,6 +40,9 @@ Patch5: %{name}-0.7-python34-ast-support.patch
Patch6: %{name}-bug-602-python35-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 # 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 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 Babel}
BuildRequires: %{python_module devel} BuildRequires: %{python_module devel}
BuildRequires: %{python_module setuptools} BuildRequires: %{python_module setuptools}
@ -48,12 +52,10 @@ BuildRequires: gcc
BuildRequires: python-rpm-macros BuildRequires: python-rpm-macros
Requires: python-Babel Requires: python-Babel
Requires: python-xml Requires: python-xml
%define oldpython python
%ifpython2 %ifpython2
Obsoletes: %{oldpython}-genshi < %{version} Obsoletes: %{oldpython}-genshi < %{version}
Provides: %{oldpython}-genshi = %{version} Provides: %{oldpython}-genshi = %{version}
%endif %endif
BuildRoot: %{_tmppath}/%{name}-%{version}-build
%python_subpackages %python_subpackages
%description %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. feature is a template language, which is heavily inspired by Kid.
%package -n %{name}-doc %package -n %{name}-doc
Summary: A toolkit for generation of output for the web - Documentation Summary: A toolkit for generation of output for the web - Documentation
Group: Development/Libraries/Python Group: Development/Libraries/Python
Requires: %{name} = %{version} Requires: %{name} = %{version}
@ -87,6 +88,8 @@ This package contains documentation and examples.
%patch5 %patch5
%patch6 -p1 %patch6 -p1
%patch7 -p1 %patch7 -p1
%patch8 -p1
%patch9 -p1
sed -i "1d" examples/{basic/run,basic/kidrun,tutorial/geddit/controller}.py # Fix non-excutable bits sed -i "1d" examples/{basic/run,basic/kidrun,tutorial/geddit/controller}.py # Fix non-excutable bits
%fdupes -s doc %fdupes -s doc
pushd examples/bench/clearsilver pushd examples/bench/clearsilver
@ -109,13 +112,12 @@ rm -f %{buildroot}%{$python_sitearch}/genshi/_speedups.c
%python_exec setup.py test %python_exec setup.py test
%files %{python_files} %files %{python_files}
%defattr(-,root,root,-) %license COPYING
%doc COPYING ChangeLog README.txt %doc ChangeLog README.txt
%{python_sitearch}/genshi/ %{python_sitearch}/genshi/
%{python_sitearch}/Genshi-%{version}-py%{python_version}.egg-info %{python_sitearch}/Genshi-%{version}-py%{python_version}.egg-info
%files -n %{name}-doc %files -n %{name}-doc
%defattr(-,root,root,-)
%doc doc examples %doc doc examples
%changelog %changelog

View File

@ -0,0 +1,32 @@
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

View File

@ -0,0 +1,47 @@
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