%if 0%{?fedora}
%global with_python3 1
%endif
%global modname chai
Name: python-%{modname}
Version: 1.1.1
Release: 1%{?dist}
Summary: Easy to use mocking/stub/spy framework
Group: Development/Libraries
License: BSD
URL: http://pypi.python.org/pypi/chai
Source0: http://pypi.python.org/packages/source/c/%{modname}/%{modname}-%{version}.tar.gz
BuildArch: noarch
BuildRequires: python2-devel
BuildRequires: python-nose
%if 0%{?with_python3}
BuildRequires: python3-devel
BuildRequires: python3-nose
%endif
%description
Chai provides a very easy to use api for mocking/stubbing your python
objects, patterned after the `Mocha <http://mocha.rubyforge.org/>`_ library
for Ruby.
%if 0%{?with_python3}
%package -n python3-%{modname}
Summary: Easy to use mocking/stub framework
Group: Development/Libraries
%description -n python3-%{modname}
Chai provides a very easy to use api for mocking/stubbing your python
objects, patterned after the `Mocha <http://mocha.rubyforge.org/>`_ library
for Ruby.
%endif
%prep
%setup -q -n %{modname}-%{version}
# Remove bundled egg-info in case it exists
rm -rf %{modname}.egg-info
%if 0%{?with_python3}
rm -rf %{py3dir}
cp -a . %{py3dir}
%endif
%build
%{__python} setup.py build
%if 0%{?with_python3}
pushd %{py3dir}
# Remove python2 compatibility files
# Makes tests fail and are not needed on python3
rm chai/python2.py
rm tests/comparator_py2.py
%{__python3} setup.py build
popd
%endif
%install
%if 0%{?with_python3}
pushd %{py3dir}
%{__python3} setup.py install -O1 --skip-build --root=%{buildroot}
popd
%endif
%{__python} setup.py install -O1 --skip-build --root=%{buildroot}
%check
%if 0%{?with_python3}
pushd %{py3dir}
%{__python3} setup.py test
popd
%endif
# Unit-tests fail on EL6 due to older python-unittest
%if 0%{?fedora} > 12 || 0%{?rhel} > 6
%{__python} setup.py test
%endif
%files
%doc README.rst LICENSE.txt
%{python_sitelib}/%{modname}/
%{python_sitelib}/%{modname}-%{version}*
%if 0%{?with_python3}
%files -n python3-%{modname}
%doc README.rst LICENSE.txt
%{python3_sitelib}/%{modname}/
%{python3_sitelib}/%{modname}-%{version}-*
%endif
%changelog
* Mon Apr 04 2016 Ralph Bean <rbean@redhat.com> - 1.1.1-1
- new version
* Thu Feb 04 2016 Fedora Release Engineering <releng@fedoraproject.org> - 1.0.1-4
- Rebuilt for https://fedoraproject.org/wiki/Fedora_24_Mass_Rebuild
* Tue Nov 10 2015 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 1.0.1-3
- Rebuilt for https://fedoraproject.org/wiki/Changes/python3.5
* Thu Jun 18 2015 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 1.0.1-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_23_Mass_Rebuild
* Wed Feb 18 2015 Ralph Bean <rbean@redhat.com> - 1.0.1-1
- new version
* Wed Oct 15 2014 Pierre-Yves Chibon <pingou@pingoured.fr> - 1.0.0
- Update to 1.0.0
* Wed Jul 09 2014 Ralph Bean <rbean@redhat.com> - 0.4.8-2
- Modernize with_python3 macro definition.
* Wed Jul 02 2014 Pierre-Yves Chibon <pingou@pingoured.fr> - 0.4.8-1
- Update to 0.4.8
* Sat Jun 07 2014 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 0.4.7-3
- Rebuilt for https://fedoraproject.org/wiki/Fedora_21_Mass_Rebuild
* Wed May 14 2014 Bohuslav Kabrda <bkabrda@redhat.com> - 0.4.7-2
- Rebuilt for https://fedoraproject.org/wiki/Changes/Python_3.4
* Wed Jan 08 2014 Pierre-Yves Chibon <pingou@pingoured.fr> 0.4.7-1
- Update to 0.4.7
* Wed Dec 04 2013 Pierre-Yves Chibon <pingou@pingoured.fr> 0.4.6-1
- Update to 0.4.6
* Sun Nov 03 2013 Pierre-Yves Chibon <pingou@pingoured.fr> 0.4.5-1
- Update to 0.4.5
- Upstream ships LICENSE file
- Re-activate the tests
* Tue Oct 29 2013 Pierre-Yves Chibon <pingou@pingoured.fr> 0.4.4-1
- initial package for Fedora