%if 0%{?fedora} %bcond_without python3 %else %bcond_with python3 %endif %global srcname zope.testrunner %global pkgname zope-testrunner Name: python-%{pkgname} Version: 4.5.0 Release: 3%{?dist} Summary: Zope testrunner script License: ZPLv2.1 URL: https://pypi.python.org/pypi/%{srcname} Source0: https://files.pythonhosted.org/packages/source/z/%{srcname}/%{srcname}-%{version}.zip BuildArch: noarch BuildRequires: help2man BuildRequires: python2-devel BuildRequires: python-fixtures BuildRequires: python2-setuptools BuildRequires: python2-six BuildRequires: python-subunit BuildRequires: python-zope-exceptions BuildRequires: python-zope-interface BuildRequires: python-zope-testing %if %{with python3} BuildRequires: python3-devel BuildRequires: python3-fixtures BuildRequires: python3-setuptools BuildRequires: python3-six BuildRequires: python3-subunit BuildRequires: python3-zope-exceptions BuildRequires: python3-zope-interface BuildRequires: python3-zope-testing %endif %description This package provides a flexible test runner with layer support. %package -n python2-%{pkgname} Summary: Zope testrunner script Requires: python2-six Requires: python-subunit Requires: python-zope-exceptions Requires: python-zope-interface Requires: python-zope-testing %{?python_provide:%python_provide python2-%{pkgname}} %description -n python2-%{pkgname} This package provides a flexible test runner with layer support. %if %{with python3} %package -n python3-%{pkgname} Summary: Zope testrunner script Requires: python3-six Requires: python3-subunit Requires: python3-zope-exceptions Requires: python3-zope-interface Requires: python3-zope-testing %{?python_provide:%python_provide python3-%{pkgname}} %description -n python3-%{pkgname} This package provides a flexible test runner with layer support. %endif %prep %setup -qc mv %{srcname}-%{version} python2 %if %{with python3} cp -a python2 python3 pushd python3 popd %endif %build pushd python2 %py2_build popd %if %{with python3} pushd python3 %py3_build popd %endif %install %if %{with python3} pushd python3 %py3_install mv %{buildroot}%{_bindir}/zope-testrunner \ %{buildroot}%{_bindir}/python3-zope-testrunner mkdir -p %{buildroot}%{_mandir}/man1 touch %{buildroot}%{python3_sitelib}/zope/__init__.py PYTHONPATH=%{buildroot}%{python3_sitelib} \ help2man -s 1 -o %{buildroot}%{_mandir}/man1/python3-zope-testrunner.1 \ -N -n "Zope testrunner script" %{buildroot}%{_bindir}/python3-zope-testrunner rm %{buildroot}%{python3_sitelib}/zope/__init__.py* rm %{buildroot}%{python3_sitelib}/zope/__pycache__/__init__.* popd %endif pushd python2 %py2_install mkdir -p %{buildroot}%{_mandir}/man1 touch %{buildroot}%{python2_sitelib}/zope/__init__.py PYTHONPATH=%{buildroot}%{python2_sitelib} \ help2man -s 1 -o %{buildroot}%{_mandir}/man1/zope-testrunner.1 \ -N -n "Zope testrunner script" %{buildroot}%{_bindir}/zope-testrunner rm %{buildroot}%{python2_sitelib}/zope/__init__.py* popd %check # The tests don't work with an uninstalled zope.testrunner because python # finds the installed zope package, which doesn't contain testrunner. We fake # out python by copying the entire installed tree to a local directory and # adding this package inside the zope directory. pushd python2 mkdir lib cp -a %{_prefix}/lib/python%{python2_version} lib if [ %{_libdir} != "%{_prefix}/lib" ]; then mkdir lib64 cp -a %{_libdir}/python%{python2_version} lib64 fi cp -a build/lib/zope/testrunner lib/python%{python2_version}/site-packages/zope export PYTHONHOME=$PWD:$PWD %{__python2} setup.py test popd # %%if %%{with python3} # The python 3 tests currently do not work. The subunit developers say the # problem lies with zope: https://bugs.launchpad.net/subunit/+bug/1336384. # The zope developers are working on the problem, but haven't fixed it yet: # https://github.com/zopefoundation/zope.testrunner/pull/23. # # pushd python3 # mkdir lib # cp -a %%{_prefix}/lib/python%%{python3_version} lib # if [ %%{_libdir} != "%%{_prefix}/lib" ]; then # mkdir lib64 # cp -a %%{_libdir}/python%%{python3_version} lib64 # fi # mkdir include # cp -a %%{_includedir}/python%%{python3_version}* include # cp -a build/lib/zope/testrunner lib/python%%{python3_version}/site-packages/zope # export PYTHONHOME=$PWD:$PWD # %%{__python3} setup.py test # popd # %%endif %files -n python2-%{pkgname} %doc python2/CHANGES.rst python2/README.rst %license python2/COPYRIGHT.rst python2/LICENSE.rst %{_bindir}/zope-testrunner %{_mandir}/man1/zope-testrunner.1* %{python2_sitelib}/zope/testrunner/ %{python2_sitelib}/%{srcname}* %if %{with python3} %files -n python3-%{pkgname} %doc python3/CHANGES.rst python3/README.rst %license python3/COPYRIGHT.rst python3/LICENSE.rst %{_bindir}/python3-zope-testrunner %{_mandir}/man1/python3-zope-testrunner.1* %{python3_sitelib}/zope/testrunner/ %{python3_sitelib}/%{srcname}* %endif %changelog * Wed Jun 8 2016 Jerry James - 4.5.0-3 - Do not test with detox; it downloads files at build time * Wed Jun 1 2016 Jerry James - 4.5.0-2 - Fix directory ownership - Add man page * Wed Jun 1 2016 Jerry James - 4.5.0-1 - Initial RPM