Accepting request 702723 from devel:languages:python

- Add multibuild in order to avoid buildcycle with Pillow and friends

- Add optional build dependencies Pillow, Pygments and roman,
  causing 16 additonal test methods to run
- Add Recommends for Pillow, Pygments and roman
- Use %license
- Simplify test invocation

OBS-URL: https://build.opensuse.org/request/show/702723
OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/python-docutils?expand=0&rev=26
This commit is contained in:
Dominique Leuenberger 2019-05-16 19:58:54 +00:00 committed by Git OBS Bridge
commit b2ad4e2204
3 changed files with 48 additions and 5 deletions

3
_multibuild Normal file
View File

@ -0,0 +1,3 @@
<multibuild>
<package>test</package>
</multibuild>

View File

@ -1,3 +1,17 @@
-------------------------------------------------------------------
Mon May 13 23:48:57 UTC 2019 - Tomáš Chvátal <tchvatal@suse.com>
- Add multibuild in order to avoid buildcycle with Pillow and friends
-------------------------------------------------------------------
Tue May 7 15:03:33 UTC 2019 - John Vandenberg <jayvdb@gmail.com>
- Add optional build dependencies Pillow, Pygments and roman,
causing 16 additonal test methods to run
- Add Recommends for Pillow, Pygments and roman
- Use %license
- Simplify test invocation
-------------------------------------------------------------------
Wed Jan 9 22:14:42 UTC 2019 - Matej Cepl <mcepl@suse.com>

View File

@ -16,22 +16,38 @@
#
%global flavor @BUILD_FLAVOR@%{nil}
%if "%{flavor}" == "test"
%define psuffix -test
%bcond_without test
%else
%define psuffix %{nil}
%bcond_with test
%endif
%{?!python_module:%define python_module() python-%{**} python3-%{**}}
Name: python-docutils
Name: python-docutils%{psuffix}
Version: 0.14
Release: 0
Summary: Python Documentation Utilities
License: Python-2.0 AND BSD-2-Clause AND GPL-2.0-or-later AND GPL-3.0-or-later AND SUSE-Public-Domain
Group: Development/Languages/Python
Url: https://pypi.python.org/pypi/docutils/
URL: https://pypi.python.org/pypi/docutils/
Source: https://files.pythonhosted.org/packages/source/d/docutils/docutils-%{version}.tar.gz
Source99: python-docutils-rpmlintrc
%if %{with test}
BuildRequires: %{python_module Pillow}
BuildRequires: %{python_module Pygments}
BuildRequires: %{python_module roman}
%endif
BuildRequires: %{python_module xml}
BuildRequires: fdupes
BuildRequires: python-rpm-macros
Requires: python-xml
Requires(post): update-alternatives
Requires(postun): update-alternatives
Recommends: python-Pillow
Recommends: python-Pygments
Recommends: python-roman
BuildArch: noarch
%ifpython3
Provides: docutils = %{version}
@ -58,7 +74,12 @@ sed -i -e "1d" "docutils/writers/xetex/__init__.py" "docutils/writers/_html_base
%build
%python_build
# test3 is generated from test during build
mv test test%{python2_bin_suffix}
mv test3 test%{python3_bin_suffix}
%install
%if !%{with test}
%python_install
%python_expand %fdupes -s %{buildroot}%{$python_sitelib}
@ -69,6 +90,7 @@ ln -s -f %{_sysconfdir}/alternatives/rst2html4 %{buildroot}%{_bindir}/rst2html4
# To avoid conflicts with the rst2html5 package
mv %{buildroot}%{_bindir}/rst2html5 %{buildroot}%{_bindir}/rst2html5-docutils
ln -s -f %{_sysconfdir}/alternatives/rst2html5 %{buildroot}%{_bindir}/rst2html5
%endif
%ifpython3
%post
@ -87,11 +109,14 @@ fi
%endif
%check
%python_exec -c 'import subprocess; import sys; sys.exit(subprocess.call([sys.executable, "test/alltests.py" if sys.version_info[0] == 2 else "test3/alltests.py"]))'
%if %{with test}
%python_exec test%{$python_bin_suffix}/alltests.py
%endif
%if !%{with test}
%files %{python_files}
%defattr(-,root,root,-)
%doc COPYING.txt FAQ.txt HISTORY.txt README.txt THANKS.txt BUGS.txt docs/* licenses
%license COPYING.txt licenses/*.txt
%doc FAQ.txt HISTORY.txt README.txt THANKS.txt BUGS.txt docs/*
%python3_only %{_bindir}/rst2html
%python3_only %{_bindir}/rst2latex
%python3_only %{_bindir}/rst2man
@ -110,5 +135,6 @@ fi
%python3_only %ghost %{_sysconfdir}/alternatives/rst2html5
%{python_sitelib}/docutils/
%{python_sitelib}/docutils-%{version}-py%{python_version}.egg-info
%endif
%changelog