From a1b835671cd40e9c14fd141f0e00df70e85ffe52 Mon Sep 17 00:00:00 2001 From: Marcel Wysocki Date: Nov 19 2012 15:25:54 +0000 Subject: added python3 support --- diff --git a/python-apsw.spec b/python-apsw.spec index f94b27e..2767969 100644 --- a/python-apsw.spec +++ b/python-apsw.spec @@ -1,22 +1,36 @@ +%if 0%{?fedora} > 12 || 0%{?rhel} > 6 +%global with_python3 1 +%else +%{!?python_sitelib: %global python_sitelib %(%{__python} -c "from distutils.sysconfig import get_python_lib; print (get_python_lib())")} +%endif + %global sqlite_version 3.7.11 %global uprel 1 %global pkg_version %{sqlite_version}-r%{uprel} %filter_provides_in %{python_sitearch}/.*\.so$ +%if 0%{?with_python3} +%filter_provides_in %{python3_sitearch}/.*\.so$ +%endif # if with_python3 %filter_setup Name: python-apsw Version: %{sqlite_version}.r%{uprel} -Release: 7%{?dist} +Release: 8%{?dist} Summary: Another Python SQLite Wrapper Source: http://apsw.googlecode.com/files/apsw-%{pkg_version}.zip URL: http://code.google.com/p/apsw/ Group: Development/Libraries License: zlib +Requires: sqlite >= %{sqlite_version} + BuildRequires: sqlite-devel >= %{sqlite_version} BuildRequires: python2-devel -Requires: sqlite >= %{sqlite_version} +%if 0%{?with_python3} +BuildRequires: python3-devel +%endif # if with_python3 + %description @@ -24,26 +38,67 @@ APSW is a Python wrapper for the SQLite embedded relational database engine. In contrast to other wrappers such as pysqlite it focuses on being a minimal layer over SQLite attempting just to translate the complete SQLite API into Python. +%if 0%{?with_python3} +%package -n python3-apsw +Summary: Another Python SQLite Wrapper Python 3 packages +Group: Development/Libraries + +%description -n python3-apsw +APSW is a Python 3 wrapper for the SQLite embedded relational database +engine. In contrast to other wrappers such as pysqlite it focuses on +being a minimal layer over SQLite attempting just to translate the +complete SQLite API into Python 3. +%endif # with_python3 + + %prep %setup -q -n "apsw-%{pkg_version}" rm doc/.buildinfo +%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|#!%{__python}|' + + %build -CFLAGS="%{optflags} -fno-strict-aliasing" \ -%__python ./setup.py build + +CFLAGS="$RPM_OPT_FLAGS" %{__python} setup.py build + +%if 0%{?with_python3} +pushd %{py3dir} +CFLAGS="$RPM_OPT_FLAGS" %{__python3} setup.py build +popd +%endif # with_python3 %install -%__python ./setup.py install \ - --prefix="%{_prefix}" \ - --root="%{buildroot}" +rm -rf %{buildroot} + +%if 0%{?with_python3} +pushd %{py3dir} +%{__python3} setup.py install --root %{buildroot} +popd +%endif # with_python3 + +%{__python} setup.py install --root %{buildroot} %files %doc doc/* %{python_sitearch}/* +%if 0%{?with_python3} +%files -n python3-apsw +%doc doc/* +%{python3_sitearch}/* +%endif # with_python3 %changelog +* Mon Nov 19 2012 Marcel Wysocki 3.7.11.r1-8 +- initial python3 build + * Tue Oct 30 2012 Marcel Wysocki 3.7.11.r1-7 - use python2-devel BR instead of python-devel