[python-aiohttp] * Wed Oct 08 2014 Fabian Affolter <mail at fabian-affolter.ch> - 0.9.1-2 - Build only a py3 package

Fabian Affolter fab at fedoraproject.org
Sun Oct 12 16:04:31 UTC 2014


commit d7d9a4ce786ace65c0022b104c57868858ee853a
Author: Fabian Affolter <fabian at affolter-engineering.ch>
Date:   Sun Oct 12 18:03:54 2014 +0200

    * Wed Oct 08 2014 Fabian Affolter <mail at fabian-affolter.ch> - 0.9.1-2
    - Build only a py3 package

 python-aiohttp.spec |   43 ++++++++++++++++++++++++++++++++++++++++---
 1 files changed, 40 insertions(+), 3 deletions(-)
---
diff --git a/python-aiohttp.spec b/python-aiohttp.spec
index 8ae35f6..39cb142 100644
--- a/python-aiohttp.spec
+++ b/python-aiohttp.spec
@@ -1,8 +1,15 @@
+%if 0%{?fedora} > 12
+%global with_python3 1
+%else
+%{!?__python2: %global __python2 /usr/bin/python2}
+%{!?python2_sitelib: %global python2_sitelib %(%{__python2} -c "from distutils.sysconfig import get_python_lib; print (get_python_lib())")}
+%endif
+
 %global srcname aiohttp
 
 Name:           python-aiohttp
 Version:        0.9.1
-Release:        1%{?dist}
+Release:        2%{?dist}
 Summary:        A Python HTTP client/server for asyncio
 
 License:        BSD
@@ -10,27 +17,57 @@ URL:            https://github.com/KeepSafe/aiohttp/
 Source0:        https://pypi.python.org/packages/source/a/%{srcname}/%{srcname}-%{version}.tar.gz
 BuildArch:      noarch
 
+BuildRequires:  python2-devel
+BuildRequires:  python-setuptools
+
+%if 0%{?with_python3}
 BuildRequires:  python3-devel
 BuildRequires:  python3-setuptools
+%endif
 
 %description
 A Python HTTP client/server for asyncio
 
+%if 0%{?with_python3}
+%package -n python3-%{srcname}
+Summary:        A Python HTTP client/server for asyncio
+
+%description -n python3-%{srcname}
+A Python HTTP client/server for asyncio
+%endif
+
 %prep
 %setup -q -n %{srcname}-%{version}
 rm -rf %{srcname}.egg-info
-find -name '*.py' | xargs sed -i '1s|^#!python|#!%{__python3}|'
+%if 0%{?with_python3}
+rm -rf %{py3dir}
+cp -a . %{py3dir}
+find %{py3dir} -name '*.py' | xargs sed -i '1s|^#!python|#!%{__python3}|'
+%endif
 
 %build
+%if 0%{?with_python3}
+pushd %{py3dir}
 %{__python3} setup.py build
+popd
+%endif
 
 %install
+%if 0%{?with_python3}
+pushd %{py3dir}
 %{__python3} setup.py install --skip-build --root %{buildroot}
+popd
+%endif
 
-%files
+%if 0%{?with_python3}
+%files -n python3-%{srcname}
 %doc CHANGES.txt CONTRIBUTORS.txt LICENSE.txt README.rst
 %{python3_sitelib}/*
+%endif
 
 %changelog
+* Wed Oct 08 2014 Fabian Affolter <mail at fabian-affolter.ch> - 0.9.1-2
+- Build only a py3 package
+
 * Wed Feb 26 2014 Fabian Affolter <mail at fabian-affolter.ch> - 0.9.1-1
 - Initial package for Fedora


More information about the scm-commits mailing list