%if 0%{?fedora} || 0%{?rhel} > 7
%global with_python3 1
%endif
Name: python-testtools
Version: 2.3.0
Release: 9%{?dist}
Summary: Extensions to the Python unit testing framework
%if 0%{?rhel}
Group: Development/Tools
%endif
License: MIT
URL: https://launchpad.net/testtools
Source0: https://pypi.io/packages/source/t/testtools/testtools-%{version}.tar.gz
Patch0: testtools-1.8.0-py3.patch
# https://github.com/testing-cabal/testtools/pull/271
Patch1: testtools-2.3.0-py37.patch
BuildArch: noarch
BuildRequires: python2-devel
BuildRequires: python2-extras
BuildRequires: python2-mimeparse >= 0.1.4
BuildRequires: python2-pbr
BuildRequires: python2-setuptools
BuildRequires: python2-unittest2 >= 1.0.0
BuildREquires: python2-traceback2
BuildRequires: python2-testscenarios
%if 0%{?with_python3}
BuildRequires: python3-devel
BuildRequires: python3-extras
BuildRequires: python3-mimeparse
BuildRequires: python3-pbr
BuildRequires: python3-setuptools
BuildRequires: python3-unittest2
BuildRequires: python3-traceback2
BuildRequires: python3-testscenarios
%endif
BuildRequires: python2-sphinx
%global _description\
testtools is a set of extensions to the Python standard library's unit testing\
framework.\
%description %_description
%package -n python2-testtools
Summary: %summary
Requires: python2-extras
Requires: python2-mimeparse
Requires: python2-pbr
Requires: python2-unittest2 >= 1.0.0
Requires: python2-traceback2
%{?python_provide:%python_provide python2-testtools}
%description -n python2-testtools %_description
%if 0%{?with_python3}
%package -n python3-testtools
Summary: Extensions to the Python unit testing framework
Requires: python3-extras
Requires: python3-mimeparse
Requires: python3-pbr
Requires: python3-unittest2 >= 1.0.0
Requires: python3-traceback2
%description -n python3-testtools
testtools is a set of extensions to the Python standard library's unit testing
framework.
%endif # with_python3
%package doc
Summary: Documentation for %{name}
Group: Documentation
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}.
%prep
%setup -q -n testtools-%{version}
%patch1 -p1 -b .py37
%if 0%{?with_python3}
rm -rf %{py3dir}
cp -a . %{py3dir}
# make the Python 3 build load the Python 3.x compatibility library directly
pushd %{py3dir}
%patch0 -p1 -b .py3
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
PYTHONPATH=$PWD make -C doc html
%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
%check
make PYTHON=%{__python2} check
%if 0%{?with_python3}
pushd %{py3dir}
make PYTHON=%{__python3} check
popd
%endif # with_python3
%files -n python2-testtools
%doc NEWS README.rst
%license LICENSE
%{python2_sitelib}/*
%if 0%{?with_python3}
%files -n python3-testtools
%doc NEWS README.rst
%license LICENSE
%{python3_sitelib}/*
%endif
%files doc
%doc doc/_build/html/*
%changelog
* Sat Jul 14 2018 Fedora Release Engineering <releng@fedoraproject.org> - 2.3.0-9
- Rebuilt for https://fedoraproject.org/wiki/Fedora_29_Mass_Rebuild
* Mon Jun 18 2018 Miro Hrončok <mhroncok@redhat.com> - 2.3.0-8
- Rebuilt for Python 3.7
* Tue Jun 05 2018 Miro Hrončok <mhroncok@redhat.com> - 2.3.0-7
- Backport upstream patch for Python 3.7 support (#1577621)
- Use python2 explicitly
* Fri Mar 09 2018 Iryna Shcherbina <ishcherb@redhat.com> - 2.3.0-6
- Update Python 2 dependency declarations to new packaging standards
(See https://fedoraproject.org/wiki/FinalizingFedoraSwitchtoPython3)
* Fri Feb 09 2018 Fedora Release Engineering <releng@fedoraproject.org> - 2.3.0-5
- Rebuilt for https://fedoraproject.org/wiki/Fedora_28_Mass_Rebuild
* Fri Sep 29 2017 Troy Dawson <tdawson@redhat.com> - 2.3.0-4
- Cleanup spec file conditionals
* Sat Aug 19 2017 Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> - 2.3.0-3
- Python 2 binary package renamed to python2-testtools
See https://fedoraproject.org/wiki/FinalizingFedoraSwitchtoPython3
* Thu Jul 27 2017 Fedora Release Engineering <releng@fedoraproject.org> - 2.3.0-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_27_Mass_Rebuild
* Wed Jun 14 2017 Haïkel Guémar <hguemar@fedoraproject.org> - 2.3.0-1
- Upstream 2.3.0
- Refresh spec
* Sat Feb 11 2017 Fedora Release Engineering <releng@fedoraproject.org> - 1.8.0-8
- Rebuilt for https://fedoraproject.org/wiki/Fedora_26_Mass_Rebuild
* Fri Dec 09 2016 Charalampos Stratakis <cstratak@redhat.com> - 1.8.0-7
- Rebuild for Python 3.6
* Tue Jul 19 2016 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 1.8.0-6
- https://fedoraproject.org/wiki/Changes/Automatic_Provides_for_Python_RPM_Packages
* Fri Jun 3 2016 Michel Alexandre Salim <salimma@fedoraproject.org> - 1.8.0-5
- Add runtime dependency on traceback2 (bz#1251568)
- Bump required version of unittest2 (bz#1304326)
* Thu Feb 04 2016 Fedora Release Engineering <releng@fedoraproject.org> - 1.8.0-4
- Rebuilt for https://fedoraproject.org/wiki/Fedora_24_Mass_Rebuild
* Tue Nov 10 2015 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 1.8.0-3
- Rebuilt for https://fedoraproject.org/wiki/Changes/python3.5
* Tue Jul 28 2015 Michel Alexandre Salim <salimma@fedoraproject.org> - 1.8.0-2
- Provide python2-testtools per updated guidelines
* Tue Jul 28 2015 Michel Alexandre Salim <salimma@fedoraproject.org> - 1.8.0-1
- Update to 1.8.0
* Thu Jun 18 2015 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 1.5.0-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_23_Mass_Rebuild
* Thu Nov 27 2014 Michel Alexandre Salim <salimma@fedoraproject.org> - 1.5.0-1
- Update to 1.5.0
* Fri Sep 19 2014 Jerry James <loganjerry@gmail.com> - 1.1.0-1
- Update to 1.1.0 (bz 1132881)
- Fix license handling
- Note bundling exception for jquery in -doc
* Sat Jun 07 2014 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 0.9.35-4
- Rebuilt for https://fedoraproject.org/wiki/Fedora_21_Mass_Rebuild
* Wed May 14 2014 Bohuslav Kabrda <bkabrda@redhat.com> - 0.9.35-3
- Rebuilt for https://fedoraproject.org/wiki/Changes/Python_3.4
* Fri Feb 28 2014 Matthias Runge <mrunge@redhat.com> - 0.9.35-2
- re-enable building the python3-subpackage
* Mon Feb 3 2014 Michel Salim <salimma@fedoraproject.org> - 0.9.35-1
- Update to 0.9.35
* Sun Aug 04 2013 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 0.9.32-3
- Rebuilt for https://fedoraproject.org/wiki/Fedora_20_Mass_Rebuild
* Thu Jul 4 2013 Michel Salim <salimma@fedoraproject.org> - 0.9.32-2
- Add new runtime dep on -extras to Python3 variant as well
* Thu Jul 4 2013 Michel Salim <salimma@fedoraproject.org> - 0.9.32-1
- Update to 0.9.32
- Switch to using split-off extras package
* Sat May 18 2013 Pádraig Brady <pbrady@redhat.com> - 0.9.30-1
- Update to 0.9.30
* Thu Feb 07 2013 Pádraig Brady <pbrady@redhat.com> - 0.9.29-1
- Update to 0.9.29
* Sat Oct 27 2012 Michel Alexandre Salim <michel@sojourner> - 0.9.21-1
- Update to 0.9.21
* Sat Oct 20 2012 Michel Salim <salimma@fedoraproject.org> - 0.9.19-1
- Update to 0.9.19
- On Fedora, also build for Python 3.x
* Wed Sep 5 2012 Michel Salim <salimma@fedoraproject.org> - 0.9.16-1
- Update to 0.9.16
- Remove deprecated sections
* Sat Jul 21 2012 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 0.9.15-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_18_Mass_Rebuild
* Fri May 11 2012 Michel Salim <salimma@fedoraproject.org> - 0.9.15-1
- Update to 0.9.15
* Thu Apr 5 2012 Michel Salim <salimma@fedoraproject.org> - 0.9.14-1
- Update to 0.9.14
- Enable unit tests
* Tue Feb 7 2012 Michel Salim <salimma@fedoraproject.org> - 0.9.13-1
- Update to 0.9.13
* Tue Jan 31 2012 Michel Salim <salimma@fedoraproject.org> - 0.9.12-1
- Update to 0.9.12
* Sat Jan 14 2012 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 0.9.11-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_17_Mass_Rebuild
* Fri Jul 15 2011 Michel Salim <salimma@fedoraproject.org> - 0.9.11-1
- Update to 0.9.11
- Enable documentation generation
* Thu Apr 7 2011 Michel Salim <salimma@fedoraproject.org> - 0.9.8-2
- Add definitions needed by older RPM versions
* Thu Apr 7 2011 Michel Salim <salimma@fedoraproject.org> - 0.9.8-1
- Initial package