Blob Blame History Raw
# Created by pyp2rpm-1.1.0b
%global pypi_name bintrees
%global with_python3 1

Name:           python-%{pypi_name}
Version:        2.0.1
Release:        3%{?dist}
Summary:        Package provides Binary-, RedBlack- and AVL-Trees in Python and Cython

License:        MIT
URL:            http://bitbucket.org/mozman/bintrees
Source0:        https://pypi.python.org/packages/source/b/%{pypi_name}/%{pypi_name}-%{version}.tar.gz
 
BuildRequires:  python-devel
BuildRequires:  Cython
 
%if %{?with_python3}
BuildRequires:  python3-devel
BuildRequires:  python3-Cython
%endif # if with_python3


%description
This Python package provides Binary- RedBlack- and AVL-Trees written 
in Python and Cython/C. This Classes are much slower than the built-in 
*dict* class, but all iterators/generators yielding data in sorted 
key order. Trees can be uses as drop in replacement for *dicts* in 
most cases.

%if 0%{?with_python3}
%package -n     python3-%{pypi_name}
Summary:        Package provides Binary-, RedBlack- and AVL-Trees in Python and Cython


%description -n python3-%{pypi_name}
This Python 3 package provides Binary- RedBlack- and AVL-Trees written 
in Python and Cython/C. This Classes are much slower than the built-in 
*dict* class, but all iterators/generators yielding data in sorted 
key order. Trees can be uses as drop in replacement for *dicts* in 
most cases.
%endif # with_python3


%prep
%setup -q -n %{pypi_name}-%{version}
find . -name '*.py' | xargs sed -i '1{\@^#!/usr/bin/env python@d}'


%if 0%{?with_python3}
rm -rf %{py3dir}
cp -a . %{py3dir}

%endif # with_python3


%build
CFLAGS="$RPM_OPT_FLAGS" %{__python2} setup.py build

%if 0%{?with_python3}
pushd %{py3dir}
CFLAGS="$RPM_OPT_FLAGS" %{__python3} setup.py build
popd
%endif # with_python3


%install
# Must do the subpackages' install first because the scripts in /usr/bin are
# overwritten with every setup.py install (and we want the python2 version
# to be the default for now).
%if 0%{?with_python3}
pushd %{py3dir}
%{__python3} setup.py install --skip-build --root %{buildroot}
popd
%endif # with_python3

%{__python2} setup.py install --skip-build --root %{buildroot}

%check
for file in tests/test*.py
do
    PYTHONPATH=%{buildroot}%{python2_sitearch} %{__python2} $file
done

%if 0%{?with_python3}
pushd %{py3dir}
for file in tests/test*.py
do
    PYTHONPATH=%{buildroot}%{python3_sitearch} %{__python3} $file
done
popd
%endif # with_python3

%files
%doc README.rst LICENSE.txt
%{python2_sitearch}/%{pypi_name}
%{python2_sitearch}/%{pypi_name}-%{version}-py?.?.egg-info
%if 0%{?with_python3}
%files -n python3-%{pypi_name}
%doc README.rst LICENSE.txt
%{python3_sitearch}/%{pypi_name}
%{python3_sitearch}/%{pypi_name}-%{version}-py?.?.egg-info
%endif # with_python3


%changelog
* Sun Aug 17 2014 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 2.0.1-3
- Rebuilt for https://fedoraproject.org/wiki/Fedora_21_22_Mass_Rebuild

* Sat Jun 07 2014 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 2.0.1-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_21_Mass_Rebuild

* Thu May 08 2014 Robert Kuska <rkuska@redhat.com> - 2.0.1-1
- Initial package.