From 0173c5354caa91b0ae8a85f6286465dacfb1cc10 Mon Sep 17 00:00:00 2001 From: Miro HronĨok Date: Mar 12 2019 11:31:12 +0000 Subject: Build with python3 Sphinx, add docs bcond --- diff --git a/python-testtools.spec b/python-testtools.spec index ca64b6e..e09b13d 100644 --- a/python-testtools.spec +++ b/python-testtools.spec @@ -1,8 +1,5 @@ -%if 0%{?fedora} || 0%{?rhel} > 7 -%global with_python3 1 -%endif - %bcond_without tests +%bcond_without docs Name: python-testtools Version: 2.3.0 @@ -31,7 +28,6 @@ BuildREquires: python2-traceback2 BuildRequires: python2-testscenarios %endif -%if 0%{?with_python3} BuildRequires: python3-devel BuildRequires: python3-extras BuildRequires: python3-mimeparse @@ -43,8 +39,9 @@ BuildRequires: python3-traceback2 BuildRequires: python3-testscenarios %endif +%if %{with docs} +BuildRequires: python3-sphinx %endif -BuildRequires: python2-sphinx %global _description\ testtools is a set of extensions to the Python standard library's unit testing\ @@ -64,7 +61,6 @@ Requires: python2-traceback2 %description -n python2-testtools %_description -%if 0%{?with_python3} %package -n python3-testtools Summary: Extensions to the Python unit testing framework @@ -78,26 +74,23 @@ Requires: python3-traceback2 testtools is a set of extensions to the Python standard library's unit testing framework. -%endif # with_python3 - +%if %{with docs} %package doc Summary: Documentation for %{name} -Requires: python2-testtools = %{version}-%{release} - # https://fedoraproject.org/wiki/Packaging:No_Bundled_Libraries#Packages_granted_temporary_exceptions Provides: bundled(jquery) %description doc This package contains HTML documentation for %{name}. +%endif %prep %setup -q -n testtools-%{version} %patch1 -p1 -b .py37 -%if 0%{?with_python3} rm -rf %{py3dir} cp -a . %{py3dir} @@ -109,30 +102,27 @@ popd find %{py3dir} -name '*.py' | xargs sed -i '1s|^#!python|#!%{__python3}|' rm %{py3dir}/testtools/_compat2x.py rm testtools/_compat3x.py -%endif # with_python3 %build %{__python2} setup.py build -%if 0%{?with_python3} pushd %{py3dir} %{__python3} setup.py build popd -%endif # with_python3 +%if %{with docs} PYTHONPATH=$PWD make -C doc html +%endif %install # do python3 install first in case python-testtools ever install scripts in # _bindir -- the one installed last should be Python 2.x's as that's the # current default -%if 0%{?with_python3} pushd %{py3dir} %{__python3} setup.py install -O1 --skip-build --root $RPM_BUILD_ROOT popd -%endif # with_python3 %{__python2} setup.py install -O1 --skip-build --root $RPM_BUILD_ROOT @@ -141,11 +131,9 @@ popd %check make PYTHON=%{__python2} check -%if 0%{?with_python3} pushd %{py3dir} make PYTHON=%{__python3} check popd -%endif # with_python3 %endif # if with tests %files -n python2-testtools @@ -153,15 +141,15 @@ popd %license LICENSE %{python2_sitelib}/* -%if 0%{?with_python3} %files -n python3-testtools %doc NEWS README.rst %license LICENSE %{python3_sitelib}/* -%endif +%if %{with docs} %files doc %doc doc/_build/html/* +%endif %changelog