diff --git a/.gitignore b/.gitignore index 3908da6..068b5c2 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1 @@ -/blist-1.3.4.tar.gz +/blist-1.3.6.tar.gz diff --git a/blist-1.2.1-use-sys-setuptools.patch b/blist-1.2.1-use-sys-setuptools.patch deleted file mode 100644 index d3e479c..0000000 --- a/blist-1.2.1-use-sys-setuptools.patch +++ /dev/null @@ -1,11 +0,0 @@ ---- blist-1.2.1/setup.py.use-sys-setuptools 2010-07-23 20:03:32.000000000 +0200 -+++ blist-1.2.1/setup.py 2010-07-26 19:20:02.755272437 +0200 -@@ -1,8 +1,6 @@ - #!/usr/bin/env python - - import sys --import distribute_setup --distribute_setup.use_setuptools() - from setuptools import setup, Extension - - define_macros = [] diff --git a/python-blist.spec b/python-blist.spec index 4090a95..4f55924 100644 --- a/python-blist.spec +++ b/python-blist.spec @@ -1,67 +1,139 @@ -%{!?python_sitearch: %global python_sitearch %(%{__python} -c "from distutils.sysconfig import get_python_lib; print get_python_lib(1)")} +%if 0%{?rhel} && 0%{?rhel} <= 6 +%{!?__python2: %global __python2 /usr/bin/python2} +%{!?python2_sitearch: %global python2_sitearch %(%{__python2} -c "from distutils.sysconfig import get_python_lib; print(get_python_lib(1))")} +%endif -Name: python-blist -Version: 1.3.4 -Release: 4%{?dist} +%if 0%{?fedora} +%global with_python3 1 +%endif + +%global srcname blist + +Name: python-%{srcname} +Version: 1.3.6 +Release: 1%{?dist} Summary: A faster list implementation for Python Group: Development/Languages License: BSD URL: http://pypi.python.org/pypi/blist/ Source0: http://pypi.python.org/packages/source/b/blist/blist-%{version}.tar.gz -Patch0: blist-1.2.1-use-sys-setuptools.patch -BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n) +#Patch0: blist-1.2.1-use-sys-setuptools.patch -BuildRequires: python-devel python-setuptools +BuildRequires: python2-devel +BuildRequires: python-setuptools +%if 0%{?with_python3} +BuildRequires: python3-devel +BuildRequires: python3-setuptools +%endif # if with_python3 %description -The BList is a type that looks, acts, and quacks like a Python list, -but has better performance for for modifying large lists. +The blist is a drop-in replacement for the Python list that provides +better performance when modifying large lists. The blist package also +provides sortedlist, sortedset, weaksortedlist, weaksortedset, +sorteddict, and btuple types. + +Python's built-in list is a dynamically-sized array; to insert or +remove an item from the beginning or middle of the list, it has to +move most of the list in memory, i.e., O(n) operations. The blist uses +a flexible, hybrid array/tree structure and only needs to move a small +portion of items in memory, specifically using O(log n) operations. + +For small lists, the blist and the built-in list have virtually +identical performance. + +%if 0%{?with_python3} +%package -n python3-%{srcname} +Summary: A faster list implementation for Python -For small lists (fewer than 128 elements), BLists and the built-in -list have very similar performance, although BLists are memory -inefficient if you need to create a larger number of small lists. +%description -n python3-%{srcname} +The blist is a drop-in replacement for the Python list that provides +better performance when modifying large lists. The blist package also +provides sortedlist, sortedset, weaksortedlist, weaksortedset, +sorteddict, and btuple types. +Python's built-in list is a dynamically-sized array; to insert or +remove an item from the beginning or middle of the list, it has to +move most of the list in memory, i.e., O(n) operations. The blist uses +a flexible, hybrid array/tree structure and only needs to move a small +portion of items in memory, specifically using O(log n) operations. + +For small lists, the blist and the built-in list have virtually +identical performance. +%endif # with_python3 %prep -%setup -q -n blist-%{version} -%patch0 -p1 -b .use-sys-setuptools +%setup -q -n %{srcname}-%{version} +#patch0 -p1 -b .use-sys-setuptools # Replace the not-zip-safe file; keep rpmlint happy by not having # CRLF line endings -echo > not-zip-safe -touch -r blist.egg-info/not-zip-safe not-zip-safe -rm blist.egg-info/not-zip-safe +#echo > not-zip-safe +#touch -r blist.egg-info/not-zip-safe not-zip-safe +#rm blist.egg-info/not-zip-safe # egg-info files should not be executables -chmod -x blist.egg-info/* +# chmod -x blist.egg-info/* # Move the new not-zip-safe file back -mv not-zip-safe blist.egg-info/ +# mv not-zip-safe blist.egg-info/ + +%if 0%{?with_python3} +rm -rf %{py3dir} +cp -a . %{py3dir} +find %{py3dir} -name '*.py' | xargs sed -i '1s|^#!python|#!%{__python3}|' +%endif # with_python3 +find -name '*.py' | xargs sed -i '1s|^#!python|#!%{__python2}|' %build -CFLAGS="$RPM_OPT_FLAGS -fno-strict-aliasing" %{__python} setup.py build +CFLAGS="$RPM_OPT_FLAGS -fno-strict-aliasing" %{__python2} setup.py build +%if 0%{?with_python3} +pushd %{py3dir} +CFLAGS="$RPM_OPT_FLAGS -fno-strict-aliasing" %{__python3} setup.py build +popd +%endif # with_python3 %install rm -rf $RPM_BUILD_ROOT -%{__python} setup.py install -O1 --skip-build --root $RPM_BUILD_ROOT +# Must do the python3 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 $RPM_BUILD_ROOT +popd +%endif # with_python3 + +%{__python2} setup.py install -O1 --skip-build --root $RPM_BUILD_ROOT %check -%{__python} setup.py test +%{__python2} setup.py test - -%clean -rm -rf $RPM_BUILD_ROOT +%if 0%{?with_python3} +pushd %{py3dir} +%{__python3} setup.py test +popd +%endif # with_python3 %files %defattr(-,root,root,-) %doc LICENSE README.rst -%{python_sitearch}/* +%{python2_sitearch}/* + +%if 0%{?with_python3} +%files -n python3-%{srcname} +%doc LICENSE README.rst +%{python3_sitearch}/* +%endif # with_python3 %changelog +* Thu May 8 2014 Michel Salim - 1.3.6-1 +- Update to 1.3.6 +- Build for Python 3 as well on supported releases + * Thu Feb 14 2013 Fedora Release Engineering - 1.3.4-4 - Rebuilt for https://fedoraproject.org/wiki/Fedora_19_Mass_Rebuild diff --git a/sources b/sources index b4b6247..9680ca7 100644 --- a/sources +++ b/sources @@ -1 +1 @@ -02e8bf33cffec9cc802f4567f39ffa6f blist-1.3.4.tar.gz +a538f1a24b9191e3c40252e9397408a9 blist-1.3.6.tar.gz