Blob Blame History Raw
%if 0%{?fedora} || 0%{?rhel} >= 8
%global with_python3 1
%endif

%global srcname orderedset
%global user simonpercivall

Name:           python-%{srcname}
Version:        2.0.1
Release:        3%{?dist}
Summary:        Ordered set implementation in Cython

License:        BSD
URL:            https://github.com/%{user}/%{srcname}
Source0:        https://files.pythonhosted.org/packages/source/o/%{srcname}/%{srcname}-%{version}.tar.gz

BuildRequires:  gcc
BuildRequires:  python2-coverage
BuildRequires:  python2-Cython
BuildRequires:  python2-devel
BuildRequires:  python2-setuptools

%if 0%{?with_python3}
BuildRequires:  python3-coverage
BuildRequires:  python3-Cython
BuildRequires:  python3-devel
BuildRequires:  python3-setuptools
%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.6.;\
- 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 %{srcname}-%{version} python3-%{srcname}-%{version}

%build
# Python 2 build
pushd %{srcname}-%{version}
%py2_build
popd

%if 0%{?with_python3}
# Python 3 build
pushd python3-%{srcname}-%{version}
%py3_build
popd
%endif

%install
# Python 2 install
pushd %{srcname}-%{version}
%py2_install
chmod 0755 %{buildroot}%{python2_sitearch}/%{srcname}/*.so
popd

%if 0%{?with_python3}
# Python 3 install
pushd python3-%{srcname}-%{version}
%py3_install
chmod 0755 %{buildroot}%{python3_sitearch}/%{srcname}/*.so
popd
%endif

%check
# Test the python 2 build
pushd %{srcname}-%{version}
PYTHONPATH=$PWD %{__python2} setup.py test
popd

%if 0%{?with_python3}
# Python 3 install
pushd python3-%{srcname}-%{version}
PYTHONPATH=$PWD %{__python3} setup.py test
popd
%endif

%files -n python2-%{srcname}
%doc %{srcname}-%{version}/AUTHORS.rst
%doc %{srcname}-%{version}/HISTORY.rst
%doc %{srcname}-%{version}/README.rst
%license %{srcname}-%{version}/LICENSE
%{python2_sitearch}/%{srcname}*

%if 0%{?with_python3}
%files -n python3-%{srcname}
%doc python3-%{srcname}-%{version}/AUTHORS.rst
%doc python3-%{srcname}-%{version}/HISTORY.rst
%doc python3-%{srcname}-%{version}/README.rst
%license python3-%{srcname}-%{version}/LICENSE
%{python3_sitearch}/%{srcname}*
%endif

%changelog
* Sat Jul 14 2018 Fedora Release Engineering <releng@fedoraproject.org> - 2.0.1-3
- Rebuilt for https://fedoraproject.org/wiki/Fedora_29_Mass_Rebuild

* Tue Jun 19 2018 Miro Hrončok <mhroncok@redhat.com> - 2.0.1-2
- Rebuilt for Python 3.7

* Mon Apr 30 2018 Jerry James <loganjerry@gmail.com> - 2.0.1-1
- New upstream version

* Fri Feb 09 2018 Fedora Release Engineering <releng@fedoraproject.org> - 2.0-7
- Rebuilt for https://fedoraproject.org/wiki/Fedora_28_Mass_Rebuild

* Thu Aug 03 2017 Fedora Release Engineering <releng@fedoraproject.org> - 2.0-6
- Rebuilt for https://fedoraproject.org/wiki/Fedora_27_Binutils_Mass_Rebuild

* Thu Jul 27 2017 Fedora Release Engineering <releng@fedoraproject.org> - 2.0-5
- Rebuilt for https://fedoraproject.org/wiki/Fedora_27_Mass_Rebuild

* 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