%if 0%{?fedora}
%bcond_without python3
%else
%bcond_with python3
%endif
%global srcname zope.testrunner
%global pkgname zope-testrunner
Name: python-%{pkgname}
Version: 4.8.1
Release: 2%{?dist}
Summary: Zope testrunner script
License: ZPLv2.1
URL: https://pypi.python.org/pypi/%{srcname}
Source0: https://github.com/zopefoundation/%{srcname}/archive/%{version}/%{srcname}-%{version}.tar.gz
BuildArch: noarch
BuildRequires: help2man
BuildRequires: python2-devel
BuildRequires: python2-fixtures
BuildRequires: python2-setuptools
BuildRequires: python2-six
BuildRequires: python2-zope-exceptions
BuildRequires: python2-zope-interface
BuildRequires: python2-zope-testing
%if %{with python3}
BuildRequires: python3-devel
BuildRequires: python3-fixtures
BuildRequires: python3-setuptools
BuildRequires: python3-six
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: python2-zope-exceptions
Requires: python2-zope-interface
Requires: python2-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-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 [ ! -e python2/src/zope/testrunner/tests/testrunner-ex/__init__.py ]; then
touch python2/src/zope/testrunner/tests/testrunner-ex/__init__.py
fi
%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
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
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
touch lib/python%{python2_version}/site-packages/zope/__init__.py
if [ -d %{_prefix}/lib64/python%{python2_version} ]; then
mkdir lib64
cp -a %{_prefix}/lib64/python%{python2_version} lib64
touch lib64/python%{python2_version}/site-packages/zope/__init__.py
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}
pushd python3
mkdir lib
cp -a %{_prefix}/lib/python%{python3_version} lib
touch lib/python%{python3_version}/site-packages/zope/__init__.py
if [ -d %{_prefix}/lib64/python%{python3_version} ]; then
mkdir lib64
cp -a %{_prefix}/lib64/python%{python3_version} lib64
touch lib64/python%{python3_version}/site-packages/zope/__init__.py
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
* Fri Feb 09 2018 Fedora Release Engineering <releng@fedoraproject.org> - 4.8.1-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_28_Mass_Rebuild
* Sun Nov 12 2017 Jerry James <loganjerry@gmail.com> - 4.8.1-1
- New upstream version
* Sat Nov 11 2017 Jerry James <loganjerry@gmail.com> - 4.8.0-1
- New upstream version
* Thu Jul 27 2017 Fedora Release Engineering <releng@fedoraproject.org> - 4.7.0-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_27_Mass_Rebuild
* Tue May 30 2017 Jerry James <loganjerry@gmail.com> - 4.7.0-1
- New upstream version
- subunit is no longer a dependency
- Enable python 3 tests
* Sat Feb 11 2017 Fedora Release Engineering <releng@fedoraproject.org> - 4.6.0-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_26_Mass_Rebuild
* Wed Dec 28 2016 Jerry James <loganjerry@gmail.com> - 4.6.0-1
- New upstream version
- Drop upstreamed test patch
* Mon Dec 19 2016 Miro HronĨok <mhroncok@redhat.com> - 4.5.1-4
- Rebuild for Python 3.6
* Tue Jul 19 2016 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 4.5.1-3
- https://fedoraproject.org/wiki/Changes/Automatic_Provides_for_Python_RPM_Packages
* Tue Jun 21 2016 Jerry James <loganjerry@gmail.com> - 4.5.1-2
- Fix spurious build failures due to use of _libdir in a noarch package
* Mon Jun 20 2016 Jerry James <loganjerry@gmail.com> - 4.5.1-1
- New upstream version
* Wed Jun 8 2016 Jerry James <loganjerry@gmail.com> - 4.5.0-3
- Do not test with detox; it downloads files at build time
* Wed Jun 1 2016 Jerry James <loganjerry@gmail.com> - 4.5.0-2
- Fix directory ownership
- Add man page
* Wed Jun 1 2016 Jerry James <loganjerry@gmail.com> - 4.5.0-1
- Initial RPM