# The pypi tarballs do not include the tests, so we use a github checkout.
%global gitdate 20160202
%global gittag 1f5d3eb04807cd5485e95463f43dd61f6f2fb0f1
%global shorttag %(cut -b -7 <<< %{gittag})
%global user simonpercivall
%if 0%{?fedora} || 0%{?rhel} >= 8
%global with_python3 1
%endif
%global srcname orderedset
Name: python-%{srcname}
Version: 2.0
Release: 4%{?dist}
Summary: Ordered set implementation in Cython
License: BSD
URL: https://github.com/%{user}/%{srcname}
Source0: https://github.com/%{user}/%{srcname}/tarball/%{gittag}/%{user}-%{srcname}-%{shorttag}.tar.gz
BuildRequires: gcc
BuildRequires: python2-coverage
BuildRequires: python2-Cython
BuildRequires: python2-devel
BuildRequires: python2-setuptools
BuildRequires: python2-sphinx
BuildRequires: python2-sphinx_rtd_theme
%if 0%{?with_python3}
BuildRequires: python3-coverage
BuildRequires: python3-Cython
BuildRequires: python3-devel
BuildRequires: python3-setuptools
BuildRequires: python3-sphinx
BuildRequires: python3-sphinx_rtd_theme
%endif
%global common_desc \
This package contains an ordered set implementation in Cython. Features:\
- Works like a regular set, but remembers insertion order;\
- Is approximately 5 times faster than the pure Python implementation\
overall (and 5 times slower than set);\
- Compatible with Python 2.6 through 3.4.;\
- Supports the full set interface;\
- Supports some list methods, like index and __getitem__.\
- Supports set methods against iterables.
%description
%common_desc
%package -n python2-%{srcname}
Summary: Ordered set implementation in Cython
Provides: bundled(jquery)
Provides: bundled(js-underscore)
%{?python_provide:%python_provide python2-%{srcname}}
%description -n python2-%{srcname}
%common_desc
%if 0%{?with_python3}
%package -n python3-%{srcname}
Summary: Ordered set implementation in Cython
Provides: bundled(jquery)
Provides: bundled(js-underscore)
%{?python_provide:%python_provide python3-%{srcname}}
%description -n python3-%{srcname}
%common_desc
%endif
%prep
%setup -q -c
# Prepare for python3 build
cp -a %{user}-%{srcname}-%{shorttag} python3-%{srcname}-%{shorttag}
%build
# Python 2 build
pushd %{user}-%{srcname}-%{shorttag}
%py2_build
PYTHONPATH=$(echo $PWD/build/lib.linux-*) make -C docs html \
SPHINXBUILD=%{_bindir}/sphinx-build-%{python2_version}
rm -f docs/_build/html/.buildinfo
popd
%if 0%{?with_python3}
# Python 3 build
pushd python3-%{srcname}-%{shorttag}
%py3_build
PYTHONPATH=$(echo $PWD/build/lib.linux-*) make -C docs html \
SPHINXBUILD=%{_bindir}/sphinx-build-%{python3_version}
rm -f docs/_build/html/.buildinfo
popd
%endif
%install
# Python 2 install
pushd %{user}-%{srcname}-%{shorttag}
%py2_install
chmod 0755 %{buildroot}%{python2_sitearch}/%{srcname}/*.so
popd
%if 0%{?with_python3}
# Python 3 install
pushd python3-%{srcname}-%{shorttag}
%py3_install
chmod 0755 %{buildroot}%{python3_sitearch}/%{srcname}/*.so
popd
%endif
%check
# Test the python 2 build
pushd %{user}-%{srcname}-%{shorttag}
PYTHONPATH=$PWD %{__python2} setup.py test
popd
%if 0%{?with_python3}
# Python 3 install
pushd python3-%{srcname}-%{shorttag}
PYTHONPATH=$PWD %{__python3} setup.py test
popd
%endif
%files -n python2-%{srcname}
%doc %{user}-%{srcname}-%{shorttag}/docs/_build/html/*
%license %{user}-%{srcname}-%{shorttag}/LICENSE
%{python2_sitearch}/%{srcname}*
%if 0%{?with_python3}
%files -n python3-%{srcname}
%doc python3-%{srcname}-%{shorttag}/docs/_build/html/*
%license python3-%{srcname}-%{shorttag}/LICENSE
%{python3_sitearch}/%{srcname}*
%endif
%changelog
* Sat Feb 11 2017 Fedora Release Engineering <releng@fedoraproject.org> - 2.0-4
- Rebuilt for https://fedoraproject.org/wiki/Fedora_26_Mass_Rebuild
* Mon Dec 19 2016 Miro HronĨok <mhroncok@redhat.com> - 2.0-3
- Rebuild for Python 3.6
* Tue Jul 19 2016 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 2.0-2
- https://fedoraproject.org/wiki/Changes/Automatic_Provides_for_Python_RPM_Packages
* Thu Feb 25 2016 Jerry James <loganjerry@gmail.com> - 2.0-1
- Initial RPM