File python-Genshi.spec of Package python-Genshi

#
# spec file for package python-Genshi
#
# 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
# upon. The license for this file, and modifications and additions to the
# file, is the same license as for the pristine package itself (unless the
# license for the pristine package is not an Open Source License, in which
# case the license is the MIT License). An "Open Source License" is a
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.

# Please submit bugfixes or comments via http://bugs.opensuse.org/
#


%{?!python_module:%define python_module() python-%{**} python3-%{**}}
%define oldpython python
Name:           python-Genshi
Version:        0.7
Release:        0
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
# PATCH-FIX-UPSTREAM python-Genshi-0.7-sanitizer-test-fixes.patch https://genshi.edgewall.org/ticket/500
Patch2:         %{name}-0.7-sanitizer-test-fixes.patch
# PATCH-FIX-UPSTREAM python-Genshi-0.7-disable-speedups-for-python34.patch https://genshi.edgewall.org/ticket/555
Patch3:         %{name}-0.7-disable-speedups-for-python34.patch
# PATCH-FIX-UPSTREAM python-Genshi-0.7-isstring-helper.patch https://genshi.edgewall.org/ticket/582
Patch4:         %{name}-0.7-isstring-helper.patch
# PATCH-FIX-UPSTREAM python-Genshi-python34-ast-support.patch https://genshi.edgewall.org/ticket/582
Patch5:         %{name}-0.7-python34-ast-support.patch
# PATCH-FIX-UPSTREAM python-Genshi-python35-support.patch http://genshi.edgewall.org/ticket/602
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}
BuildRequires:  %{python_module xml}
BuildRequires:  fdupes
BuildRequires:  gcc
BuildRequires:  python-rpm-macros
Requires:       python-Babel
Requires:       python-xml
%ifpython2
Obsoletes:      %{oldpython}-genshi < %{version}
Provides:       %{oldpython}-genshi = %{version}
%endif
%python_subpackages

%description
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. 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}
Provides:       %{python_module Genshi-doc = %{version}}
BuildArch:      noarch

%description -n %{name}-doc
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. The major
feature is a template language, which is heavily inspired by Kid.

This package contains documentation and examples.

%prep
%setup -q -n Genshi-%{version}
%patch1 -p2
%patch2
%patch3
%patch4
%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
ln -s -f ../mako/footer.html footer.cs
popd
pushd examples/bench/cheetah
ln -s -f ../mako/footer.html footer.tmpl
popd

%build
%python_build

%install
%{python_expand %$python_install --install-lib=%{$python_sitearch}
rm -f %{buildroot}%{$python_sitearch}/genshi/_speedups.c
%fdupes -s %{buildroot}%{$python_sitearch}
}

%check
%python_exec setup.py test

%files %{python_files}
%license COPYING
%doc ChangeLog README.txt
%{python_sitearch}/genshi/
%{python_sitearch}/Genshi-%{version}-py%{python_version}.egg-info

%files -n %{name}-doc
%doc doc examples

%changelog