e864b2
%if 0%{?rhel} && 0%{?rhel} <= 6
e864b2
%{!?__python2: %global __python2 /usr/bin/python2}
e864b2
%{!?python2_sitearch: %global python2_sitearch %(%{__python2} -c "from distutils.sysconfig import get_python_lib; print(get_python_lib(1))")}
e864b2
%endif
9feed6
e864b2
%if 0%{?fedora}
e864b2
%global with_python3 1
e864b2
%endif
e864b2
e864b2
%global srcname blist
e864b2
e864b2
Name:           python-%{srcname}
e864b2
Version:        1.3.6
e864b2
Release:        1%{?dist}
9feed6
Summary:        A faster list implementation for Python
9feed6
9feed6
Group:          Development/Languages
9feed6
License:        BSD
9feed6
URL:            http://pypi.python.org/pypi/blist/
9feed6
Source0:        http://pypi.python.org/packages/source/b/blist/blist-%{version}.tar.gz
0a7466
# EL7 has setuptools 0.9.8, not 1.1.6
0a7466
# override the version specified in ez_setup.py
0a7466
Patch0:         blist-1.3.6-el7_098.patch
9feed6
e864b2
BuildRequires:  python2-devel
e864b2
BuildRequires:  python-setuptools
e864b2
%if 0%{?with_python3}
e864b2
BuildRequires:  python3-devel
0a7466
BuildRequires:  python3-setuptools
e864b2
%endif # if with_python3
9feed6
9feed6
%description
e864b2
The blist is a drop-in replacement for the Python list that provides
e864b2
better performance when modifying large lists. The blist package also
e864b2
provides sortedlist, sortedset, weaksortedlist, weaksortedset,
e864b2
sorteddict, and btuple types.
e864b2
e864b2
Python's built-in list is a dynamically-sized array; to insert or
e864b2
remove an item from the beginning or middle of the list, it has to
e864b2
move most of the list in memory, i.e., O(n) operations. The blist uses
e864b2
a flexible, hybrid array/tree structure and only needs to move a small
e864b2
portion of items in memory, specifically using O(log n) operations.
e864b2
e864b2
For small lists, the blist and the built-in list have virtually
e864b2
identical performance.
e864b2
e864b2
%if 0%{?with_python3}
e864b2
%package -n python3-%{srcname}
e864b2
Summary:        A faster list implementation for Python
9feed6
e864b2
%description -n python3-%{srcname}
e864b2
The blist is a drop-in replacement for the Python list that provides
e864b2
better performance when modifying large lists. The blist package also
e864b2
provides sortedlist, sortedset, weaksortedlist, weaksortedset,
e864b2
sorteddict, and btuple types.
9feed6
e864b2
Python's built-in list is a dynamically-sized array; to insert or
e864b2
remove an item from the beginning or middle of the list, it has to
e864b2
move most of the list in memory, i.e., O(n) operations. The blist uses
e864b2
a flexible, hybrid array/tree structure and only needs to move a small
e864b2
portion of items in memory, specifically using O(log n) operations.
e864b2
e864b2
For small lists, the blist and the built-in list have virtually
e864b2
identical performance.
e864b2
%endif # with_python3
9feed6
9feed6
%prep
e864b2
%setup -q -n %{srcname}-%{version}
0a7466
%if 0%{?el7}
0a7466
%patch0 -p1 -b .el7_098
0a7466
%endif
1392ef
9feed6
# Replace the not-zip-safe file; keep rpmlint happy by not having
9feed6
# CRLF line endings
e864b2
#echo > not-zip-safe
e864b2
#touch -r blist.egg-info/not-zip-safe not-zip-safe
e864b2
#rm blist.egg-info/not-zip-safe
9feed6
# egg-info files should not be executables
e864b2
# chmod -x blist.egg-info/*
9feed6
# Move the new not-zip-safe file back
e864b2
# mv not-zip-safe blist.egg-info/
e864b2
e864b2
%if 0%{?with_python3}
e864b2
rm -rf %{py3dir}
e864b2
cp -a . %{py3dir}
e864b2
find %{py3dir} -name '*.py' | xargs sed -i '1s|^#!python|#!%{__python3}|'
e864b2
%endif # with_python3
9feed6
e864b2
find -name '*.py' | xargs sed -i '1s|^#!python|#!%{__python2}|'
9feed6
9feed6
%build
e864b2
CFLAGS="$RPM_OPT_FLAGS -fno-strict-aliasing" %{__python2} setup.py build
9feed6
e864b2
%if 0%{?with_python3}
e864b2
pushd %{py3dir}
e864b2
CFLAGS="$RPM_OPT_FLAGS -fno-strict-aliasing" %{__python3} setup.py build
e864b2
popd
e864b2
%endif # with_python3
9feed6
9feed6
%install
9feed6
rm -rf $RPM_BUILD_ROOT
e864b2
# Must do the python3 install first because the scripts in /usr/bin are
e864b2
# overwritten with every setup.py install (and we want the python2 version
e864b2
# to be the default for now).
e864b2
%if 0%{?with_python3}
e864b2
pushd %{py3dir}
e864b2
%{__python3} setup.py install --skip-build --root $RPM_BUILD_ROOT
e864b2
popd
e864b2
%endif # with_python3
e864b2
e864b2
%{__python2} setup.py install -O1 --skip-build --root $RPM_BUILD_ROOT
9feed6
9feed6
 
9feed6
%check
e864b2
%{__python2} setup.py test
9feed6
e864b2
%if 0%{?with_python3}
e864b2
pushd %{py3dir}
e864b2
%{__python3} setup.py test
e864b2
popd
e864b2
%endif # with_python3
9feed6
9feed6
9feed6
%files
9feed6
%defattr(-,root,root,-)
70bdc2
%doc LICENSE README.rst
e864b2
%{python2_sitearch}/*
e864b2
e864b2
%if 0%{?with_python3}
e864b2
%files -n python3-%{srcname}
e864b2
%doc LICENSE README.rst
e864b2
%{python3_sitearch}/*
e864b2
%endif # with_python3
9feed6
9feed6
9feed6
%changelog
e864b2
* Thu May  8 2014 Michel Salim <salimma@fedoraproject.org> - 1.3.6-1
e864b2
- Update to 1.3.6
e864b2
- Build for Python 3 as well on supported releases
e864b2
5f69e8
* Thu Feb 14 2013 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 1.3.4-4
5f69e8
- Rebuilt for https://fedoraproject.org/wiki/Fedora_19_Mass_Rebuild
5f69e8
9a3307
* Sat Jul 21 2012 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 1.3.4-3
9a3307
- Rebuilt for https://fedoraproject.org/wiki/Fedora_18_Mass_Rebuild
9a3307
b60569
* Sat Jan 14 2012 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 1.3.4-2
b60569
- Rebuilt for https://fedoraproject.org/wiki/Fedora_17_Mass_Rebuild
b60569
Michel Alexandre Salim 3d46bf
* Sat Jul  2 2011 Michel Salim <salimma@fedoraproject.org> - 1.3.4-1
Michel Alexandre Salim 3d46bf
- Update to 1.3.4
Michel Alexandre Salim 3d46bf
16805e
* Tue Feb 08 2011 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 1.2.1-3
16805e
- Rebuilt for https://fedoraproject.org/wiki/Fedora_15_Mass_Rebuild
16805e
6f38bc
* Mon Jul 26 2010 David Malcolm <dmalcolm@redhat.com> - 1.2.1-2
6f38bc
- Rebuilt for https://fedoraproject.org/wiki/Features/Python_2.7/MassRebuild
6f38bc
70bdc2
* Mon Jul 26 2010 Michel Salim <salimma@fedoraproject.org> - 1.2.1-1
70bdc2
- Update to 1.2.1
70bdc2
9feed6
* Fri May 21 2010 Michel Salim <salimma@fedoraproject.org> - 1.1.1-1
9feed6
- Update to 1.1.1
9feed6
9feed6
* Fri Oct 23 2009 Michel Salim <salimma@fedoraproject.org> - 1.0.2-1
9feed6
- Update to 1.0.2
9feed6
9feed6
* Sat Oct 10 2009 Michel Salim <salimma@fedoraproject.org> - 1.0.1-1
9feed6
- Initial package
9feed6