%if 0%{?fedora} > 12 || 0%{?rhel} > 6
%global with_python3 1
%endif
%global modname chai
Name: python-%{modname}
Version: 0.4.7
Release: 1%{?dist}
Summary: Easy to use mocking/stub 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
* 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