db6ee53
%if 0%{?rhel} && 0%{?rhel} <= 6
db6ee53
%{!?__python2: %global __python2 /usr/bin/python2}
db6ee53
%{!?python2_sitearch: %global python2_sitearch %(%{__python2} -c "from distutils.sysconfig import get_python_lib; print(get_python_lib(1))")}
db6ee53
%endif
9feed6c
db6ee53
%if 0%{?fedora}
db6ee53
%global with_python3 1
db6ee53
%endif
db6ee53
db6ee53
%global srcname blist
db6ee53
db6ee53
Name:           python-%{srcname}
db6ee53
Version:        1.3.6
d09b1f6
Release:        12%{?dist}
9feed6c
Summary:        A faster list implementation for Python
9feed6c
9feed6c
Group:          Development/Languages
9feed6c
License:        BSD
9feed6c
URL:            http://pypi.python.org/pypi/blist/
9feed6c
Source0:        http://pypi.python.org/packages/source/b/blist/blist-%{version}.tar.gz
7b63b8f
# EL7 has setuptools 0.9.8, not 1.1.6
7b63b8f
# override the version specified in ez_setup.py
7b63b8f
Patch0:         blist-1.3.6-el7_098.patch
9feed6c
db6ee53
BuildRequires:  python2-devel
db6ee53
BuildRequires:  python-setuptools
db6ee53
%if 0%{?with_python3}
db6ee53
BuildRequires:  python3-devel
7b63b8f
BuildRequires:  python3-setuptools
db6ee53
%endif # if with_python3
9feed6c
9feed6c
%description
db6ee53
The blist is a drop-in replacement for the Python list that provides
db6ee53
better performance when modifying large lists. The blist package also
db6ee53
provides sortedlist, sortedset, weaksortedlist, weaksortedset,
db6ee53
sorteddict, and btuple types.
db6ee53
db6ee53
Python's built-in list is a dynamically-sized array; to insert or
db6ee53
remove an item from the beginning or middle of the list, it has to
db6ee53
move most of the list in memory, i.e., O(n) operations. The blist uses
db6ee53
a flexible, hybrid array/tree structure and only needs to move a small
db6ee53
portion of items in memory, specifically using O(log n) operations.
db6ee53
db6ee53
For small lists, the blist and the built-in list have virtually
db6ee53
identical performance.
db6ee53
db6ee53
%if 0%{?with_python3}
db6ee53
%package -n python3-%{srcname}
db6ee53
Summary:        A faster list implementation for Python
9feed6c
db6ee53
%description -n python3-%{srcname}
db6ee53
The blist is a drop-in replacement for the Python list that provides
db6ee53
better performance when modifying large lists. The blist package also
db6ee53
provides sortedlist, sortedset, weaksortedlist, weaksortedset,
db6ee53
sorteddict, and btuple types.
9feed6c
db6ee53
Python's built-in list is a dynamically-sized array; to insert or
db6ee53
remove an item from the beginning or middle of the list, it has to
db6ee53
move most of the list in memory, i.e., O(n) operations. The blist uses
db6ee53
a flexible, hybrid array/tree structure and only needs to move a small
db6ee53
portion of items in memory, specifically using O(log n) operations.
db6ee53
db6ee53
For small lists, the blist and the built-in list have virtually
db6ee53
identical performance.
db6ee53
%endif # with_python3
9feed6c
9feed6c
%prep
db6ee53
%setup -q -n %{srcname}-%{version}
7b63b8f
%if 0%{?el7}
7b63b8f
%patch0 -p1 -b .el7_098
7b63b8f
%endif
1392efd
9feed6c
# Replace the not-zip-safe file; keep rpmlint happy by not having
9feed6c
# CRLF line endings
db6ee53
#echo > not-zip-safe
db6ee53
#touch -r blist.egg-info/not-zip-safe not-zip-safe
db6ee53
#rm blist.egg-info/not-zip-safe
9feed6c
# egg-info files should not be executables
db6ee53
# chmod -x blist.egg-info/*
9feed6c
# Move the new not-zip-safe file back
db6ee53
# mv not-zip-safe blist.egg-info/
db6ee53
db6ee53
%if 0%{?with_python3}
db6ee53
rm -rf %{py3dir}
db6ee53
cp -a . %{py3dir}
db6ee53
find %{py3dir} -name '*.py' | xargs sed -i '1s|^#!python|#!%{__python3}|'
db6ee53
%endif # with_python3
9feed6c
db6ee53
find -name '*.py' | xargs sed -i '1s|^#!python|#!%{__python2}|'
9feed6c
9feed6c
%build
db6ee53
CFLAGS="$RPM_OPT_FLAGS -fno-strict-aliasing" %{__python2} setup.py build
9feed6c
db6ee53
%if 0%{?with_python3}
db6ee53
pushd %{py3dir}
db6ee53
CFLAGS="$RPM_OPT_FLAGS -fno-strict-aliasing" %{__python3} setup.py build
db6ee53
popd
db6ee53
%endif # with_python3
9feed6c
9feed6c
%install
9feed6c
rm -rf $RPM_BUILD_ROOT
db6ee53
# Must do the python3 install first because the scripts in /usr/bin are
db6ee53
# overwritten with every setup.py install (and we want the python2 version
db6ee53
# to be the default for now).
db6ee53
%if 0%{?with_python3}
db6ee53
pushd %{py3dir}
db6ee53
%{__python3} setup.py install --skip-build --root $RPM_BUILD_ROOT
db6ee53
popd
db6ee53
%endif # with_python3
db6ee53
db6ee53
%{__python2} setup.py install -O1 --skip-build --root $RPM_BUILD_ROOT
9feed6c
9feed6c
 
9feed6c
%check
db6ee53
%{__python2} setup.py test
9feed6c
db6ee53
%if 0%{?with_python3}
db6ee53
pushd %{py3dir}
db6ee53
%{__python3} setup.py test
db6ee53
popd
db6ee53
%endif # with_python3
9feed6c
9feed6c
9feed6c
%files
9feed6c
%defattr(-,root,root,-)
70bdc2a
%doc LICENSE README.rst
db6ee53
%{python2_sitearch}/*
db6ee53
db6ee53
%if 0%{?with_python3}
db6ee53
%files -n python3-%{srcname}
db6ee53
%doc LICENSE README.rst
db6ee53
%{python3_sitearch}/*
db6ee53
%endif # with_python3
9feed6c
9feed6c
9feed6c
%changelog
d09b1f6
* Thu Aug 03 2017 Fedora Release Engineering <releng@fedoraproject.org> - 1.3.6-12
d09b1f6
- Rebuilt for https://fedoraproject.org/wiki/Fedora_27_Binutils_Mass_Rebuild
d09b1f6
95b5e17
* Thu Jul 27 2017 Fedora Release Engineering <releng@fedoraproject.org> - 1.3.6-11
95b5e17
- Rebuilt for https://fedoraproject.org/wiki/Fedora_27_Mass_Rebuild
95b5e17
cfaacd5
* Sat Feb 11 2017 Fedora Release Engineering <releng@fedoraproject.org> - 1.3.6-10
cfaacd5
- Rebuilt for https://fedoraproject.org/wiki/Fedora_26_Mass_Rebuild
cfaacd5
f454dee
* Mon Dec 19 2016 Miro HronĨok <mhroncok@redhat.com> - 1.3.6-9
f454dee
- Rebuild for Python 3.6
f454dee
435a89c
* Tue Jul 19 2016 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 1.3.6-8
435a89c
- https://fedoraproject.org/wiki/Changes/Automatic_Provides_for_Python_RPM_Packages
435a89c
0131d10
* Thu Feb 04 2016 Fedora Release Engineering <releng@fedoraproject.org> - 1.3.6-7
0131d10
- Rebuilt for https://fedoraproject.org/wiki/Fedora_24_Mass_Rebuild
0131d10
4df965a
* Tue Nov 10 2015 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 1.3.6-6
4df965a
- Rebuilt for https://fedoraproject.org/wiki/Changes/python3.5
4df965a
97f2d75
* Thu Jun 18 2015 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 1.3.6-5
97f2d75
- Rebuilt for https://fedoraproject.org/wiki/Fedora_23_Mass_Rebuild
97f2d75
8899946
* Sun Aug 17 2014 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 1.3.6-4
8899946
- Rebuilt for https://fedoraproject.org/wiki/Fedora_21_22_Mass_Rebuild
8899946
b0ee16f
* Sat Jun 07 2014 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 1.3.6-3
b0ee16f
- Rebuilt for https://fedoraproject.org/wiki/Fedora_21_Mass_Rebuild
b0ee16f
5951e99
* Tue May 27 2014 Kalev Lember <kalevlember@gmail.com> - 1.3.6-2
5951e99
- Rebuilt for https://fedoraproject.org/wiki/Changes/Python_3.4
5951e99
db6ee53
* Thu May  8 2014 Michel Salim <salimma@fedoraproject.org> - 1.3.6-1
db6ee53
- Update to 1.3.6
db6ee53
- Build for Python 3 as well on supported releases
db6ee53
32edcf8
* Sun Aug 04 2013 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 1.3.4-5
32edcf8
- Rebuilt for https://fedoraproject.org/wiki/Fedora_20_Mass_Rebuild
32edcf8
5f69e8c
* Thu Feb 14 2013 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 1.3.4-4
5f69e8c
- Rebuilt for https://fedoraproject.org/wiki/Fedora_19_Mass_Rebuild
5f69e8c
9a33075
* Sat Jul 21 2012 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 1.3.4-3
9a33075
- Rebuilt for https://fedoraproject.org/wiki/Fedora_18_Mass_Rebuild
9a33075
b605696
* Sat Jan 14 2012 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 1.3.4-2
b605696
- Rebuilt for https://fedoraproject.org/wiki/Fedora_17_Mass_Rebuild
b605696
Michel Alexandre Salim 3d46bf7
* Sat Jul  2 2011 Michel Salim <salimma@fedoraproject.org> - 1.3.4-1
Michel Alexandre Salim 3d46bf7
- Update to 1.3.4
Michel Alexandre Salim 3d46bf7
16805ea
* Tue Feb 08 2011 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 1.2.1-3
16805ea
- Rebuilt for https://fedoraproject.org/wiki/Fedora_15_Mass_Rebuild
16805ea
6f38bca
* Mon Jul 26 2010 David Malcolm <dmalcolm@redhat.com> - 1.2.1-2
6f38bca
- Rebuilt for https://fedoraproject.org/wiki/Features/Python_2.7/MassRebuild
6f38bca
70bdc2a
* Mon Jul 26 2010 Michel Salim <salimma@fedoraproject.org> - 1.2.1-1
70bdc2a
- Update to 1.2.1
70bdc2a
9feed6c
* Fri May 21 2010 Michel Salim <salimma@fedoraproject.org> - 1.1.1-1
9feed6c
- Update to 1.1.1
9feed6c
9feed6c
* Fri Oct 23 2009 Michel Salim <salimma@fedoraproject.org> - 1.0.2-1
9feed6c
- Update to 1.0.2
9feed6c
9feed6c
* Sat Oct 10 2009 Michel Salim <salimma@fedoraproject.org> - 1.0.1-1
9feed6c
- Initial package
9feed6c