commit 976e5c01686832d3365ec430515bc428ae782480
Author: Jacek Konieczny <[email protected]>
Date:   Wed Jul 15 10:30:52 2015 +0200

    Build for python3 too

 python-gevent.spec | 91 ++++++++++++++++++++++++++++++++++++++++++++++++------
 1 file changed, 82 insertions(+), 9 deletions(-)
---
diff --git a/python-gevent.spec b/python-gevent.spec
index 44c6cc4..4988a4e 100644
--- a/python-gevent.spec
+++ b/python-gevent.spec
@@ -10,12 +10,14 @@
 %bcond_without tests   # do not run tests
 %bcond_with    system_libev    # build with system libev (more tests will fail)
 %bcond_without system_c_ares   # build with system c_ares
+%bcond_without python2 # CPython 2.x module
+%bcond_without python3 # CPython 3.x module
 
 %define     module  gevent
+%define        pre     a2
 Summary:       A coroutine-based Python networking library
 Name:          python-%{module}
 Version:       1.1
-%define        pre     a2
 Release:       0.%{pre}.1
 License:       MIT
 Group:         Development/Languages
@@ -25,15 +27,27 @@ Patch0:             known_failures-pld.patch
 URL:           http://www.gevent.org/
 %{?with_system_c_ares:BuildRequires:   c-ares-devel >= 1.10.0}
 %{?with_system_libev:BuildRequires:    libev-devel >= 4.11}
+%if %{with python2}
 #BuildRequires:        python-Cython
-BuildRequires: python-devel
+BuildRequires: python-devel >= 1:2.6
+BuildRequires: python-setuptools
 %if %{with tests}
 BuildRequires: python-devel-src
 BuildRequires: python-greenlet >= 0.3.2
 BuildRequires: python-test
-BuildRequires: rpmbuild(macros) >= 1.688
+%endif
+%endif
+%if %{with python3}
+#BuildRequires:        python3-Cython
+BuildRequires: python3-devel >= 1:3.3
+BuildRequires: python3-setuptools
+%if %{with tests}
+BuildRequires: python3-greenlet >= 0.3.2
+BuildRequires: python3-test
+%endif
 %endif
 BuildRequires: rpm-pythonprov
+BuildRequires: rpmbuild(macros) >= 1.688
 Requires:      python-greenlet >= 0.3.2
 BuildRoot:     %{tmpdir}/%{name}-%{version}-root-%(id -u -n)
 
@@ -50,6 +64,25 @@ Features include:
 - Ability to use standard library and 3rd party modules written for
   standard blocking sockets
 
+%package -n python3-%{module}
+Summary:       A coroutine-based Python networking library
+Group:         Libraries/Python
+Requires:      python3-greenlet >= 0.3.2
+
+%description -n python3-%{module}
+gevent is a coroutine-based Python networking library.
+
+Features include:
+
+- Fast event loop based on libev.
+- Lightweight execution units based on greenlet.
+- Familiar API that re-uses concepts from the Python standard library.
+- Cooperative sockets with SSL support.
+- DNS queries performed through c-ares or a threadpool.
+- Ability to use standard library and 3rd party modules written for
+  standard blocking sockets
+
+
 %prep
 %setup -q -n %{module}-%{version}%{pre}
 %patch0 -p1
@@ -59,29 +92,58 @@ Features include:
 # (BR: python-Cython must be enabled then too)
 # ln -s Makefile.ext Makefile
 
+%if %{with python2}
 CC="%{__cc}" \
 CFLAGS="%{rpmcflags}" \
 %{?with_system_libev:LIBEV_EMBED=false} \
 %{?with_system_c_ares:CARES_EMBED=false} \
-%{__python} setup.py build
+%{__python} setup.py build --build-base build-2
 
 %if %{with tests}
 cd greentest
-PYTHONPATH=.. python testrunner.py --config ../known_failures.py
+PYTHONPATH=.. %{__python} testrunner.py --config ../known_failures.py
 cd ..
 %endif
+%endif
+
+%if %{with python3}
+CC="%{__cc}" \
+CFLAGS="%{rpmcflags}" \
+%{?with_system_libev:LIBEV_EMBED=false} \
+%{?with_system_c_ares:CARES_EMBED=false} \
+%{__python3} setup.py build --build-base build-3
+
+%if %{with tests}
+cd greentest
+PYTHONPATH=.. %{__python3} testrunner.py --config ../known_failures.py
+cd ..
+%endif
+%endif
 
 %install
 rm -rf $RPM_BUILD_ROOT
 
+%if %{with python2}
 %{?with_system_libev:LIBEV_EMBED=false} \
 %{?with_system_c_ares:CARES_EMBED=false} \
-%{__python} setup.py install \
-    --skip-build \
+%{__python} setup.py \
+    build --build-base build-2 \
+    install --skip-build \
     --optimize=2 \
     --root=$RPM_BUILD_ROOT
 
 %py_postclean
+%endif
+
+%if %{with python3}
+%{?with_system_libev:LIBEV_EMBED=false} \
+%{?with_system_c_ares:CARES_EMBED=false} \
+%{__python3} setup.py \
+    build --build-base build-3 \
+    install --skip-build \
+    --optimize=2 \
+    --root=$RPM_BUILD_ROOT
+%endif
 
 %clean
 rm -rf $RPM_BUILD_ROOT
@@ -95,6 +157,17 @@ rm -rf $RPM_BUILD_ROOT
 %attr(755,root,root) %{py_sitedir}/%{module}/_util.so
 %attr(755,root,root) %{py_sitedir}/%{module}/ares.so
 %attr(755,root,root) %{py_sitedir}/%{module}/core.so
-%if "%{py_ver}" > "2.4"
 %{py_sitedir}/%{module}-%{version}%{pre}-py%{py_ver}.egg-info
-%endif
+
+%files -n python3-%{module}
+%defattr(644,root,root,755)
+%doc LICENSE README.rst
+%dir %{py3_sitedir}/%{module}
+%dir %{py3_sitedir}/%{module}/__pycache__
+%{py3_sitedir}/%{module}/*.py
+%{py3_sitedir}/%{module}/__pycache__/*.py[co]
+%attr(755,root,root) %{py3_sitedir}/%{module}/_semaphore.*.so
+%attr(755,root,root) %{py3_sitedir}/%{module}/_util.*.so
+%attr(755,root,root) %{py3_sitedir}/%{module}/ares.*.so
+%attr(755,root,root) %{py3_sitedir}/%{module}/core.*.so
+%{py3_sitedir}/%{module}-%{version}%{pre}-py%{py3_ver}.egg-info
================================================================

---- gitweb:

http://git.pld-linux.org/gitweb.cgi/packages/python-gevent.git/commitdiff/976e5c01686832d3365ec430515bc428ae782480

_______________________________________________
pld-cvs-commit mailing list
[email protected]
http://lists.pld-linux.org/mailman/listinfo/pld-cvs-commit

Reply via email to