summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorArfrever Frehtes Taifersar Arahesis <arfrever@gentoo.org>2011-03-07 22:21:10 +0000
committerArfrever Frehtes Taifersar Arahesis <arfrever@gentoo.org>2011-03-07 22:21:10 +0000
commit74377a0d4f25f4c42eb2df3ba12d81b6cf0fb3af (patch)
treecf1abc6f58ffe6d4cf504f37232f0f1f7adb9c54 /dev-python/pyzmq
parentsys-boot/plymouth: rev-bump to 0.8.3-r1 (diff)
downloadgentoo-2-74377a0d4f25f4c42eb2df3ba12d81b6cf0fb3af.tar.gz
gentoo-2-74377a0d4f25f4c42eb2df3ba12d81b6cf0fb3af.tar.bz2
gentoo-2-74377a0d4f25f4c42eb2df3ba12d81b6cf0fb3af.zip
Fix building with Python 3.2 (bug #357845).
(Portage version: 2.2.0_alpha26_p8/cvs/Linux x86_64)
Diffstat (limited to 'dev-python/pyzmq')
-rw-r--r--dev-python/pyzmq/ChangeLog6
-rw-r--r--dev-python/pyzmq/files/pyzmq-2.0.10.1-python-3.2.patch147
-rw-r--r--dev-python/pyzmq/pyzmq-2.0.10.1.ebuild7
3 files changed, 157 insertions, 3 deletions
diff --git a/dev-python/pyzmq/ChangeLog b/dev-python/pyzmq/ChangeLog
index 5814b2005cb5..906b6fe3156c 100644
--- a/dev-python/pyzmq/ChangeLog
+++ b/dev-python/pyzmq/ChangeLog
@@ -1,6 +1,10 @@
# ChangeLog for dev-python/pyzmq
# Copyright 1999-2011 Gentoo Foundation; Distributed under the GPL v2
-# $Header: /var/cvsroot/gentoo-x86/dev-python/pyzmq/ChangeLog,v 1.3 2011/03/06 23:10:18 arfrever Exp $
+# $Header: /var/cvsroot/gentoo-x86/dev-python/pyzmq/ChangeLog,v 1.4 2011/03/07 22:21:10 arfrever Exp $
+
+ 07 Mar 2011; Arfrever Frehtes Taifersar Arahesis <arfrever@gentoo.org>
+ pyzmq-2.0.10.1.ebuild, +files/pyzmq-2.0.10.1-python-3.2.patch:
+ Fix building with Python 3.2 (bug #357845).
06 Mar 2011; Arfrever Frehtes Taifersar Arahesis <arfrever@gentoo.org>
pyzmq-2.0.10.1.ebuild, +files/pyzmq-2.0.10.1-python-3.1.patch:
diff --git a/dev-python/pyzmq/files/pyzmq-2.0.10.1-python-3.2.patch b/dev-python/pyzmq/files/pyzmq-2.0.10.1-python-3.2.patch
new file mode 100644
index 000000000000..a89a1371d883
--- /dev/null
+++ b/dev-python/pyzmq/files/pyzmq-2.0.10.1-python-3.2.patch
@@ -0,0 +1,147 @@
+https://github.com/zeromq/pyzmq/commit/c963d9a5aeb26d60026bf3472e98a6337f12330f
+https://github.com/zeromq/pyzmq/commit/7acb75644de0b94fbc4b5fff103395b0a7871d17
+
+--- setup.py
++++ setup.py
+@@ -197,18 +197,17 @@
+ return os.path.abspath(pjoin('zmq', subdir, name+'.c'))
+
+ czmq = pxd('core', 'czmq')
+-allocate = pxd('utils', 'allocate')
+ buffers = pxd('utils', 'buffers')
+
+ submodules = dict(
+ core = {'constants': [czmq],
+ 'error':[czmq],
+- 'poll':[czmq, allocate],
++ 'poll':[czmq],
+ 'stopwatch':[czmq],
+ 'context':[pxd('core', 'socket'), czmq],
+ 'message':[czmq, buffers],
+ 'socket':[pxd('core', 'context'), pxd('core', 'message'),
+- czmq, allocate, buffers],
++ czmq, buffers],
+ 'device':[czmq],
+ 'version':[czmq],
+ },
+--- zmq/core/czmq.pxd
++++ zmq/core/czmq.pxd
+@@ -27,6 +27,9 @@
+ # Import the C header files
+ #-----------------------------------------------------------------------------
+
++cdef extern from "allocate.h":
++ object allocate(size_t n, void **pp)
++
+ cdef extern from "errno.h" nogil:
+ enum: ZMQ_EINVAL "EINVAL"
+ enum: ZMQ_EAGAIN "EAGAIN"
+--- zmq/core/poll.pyx
++++ zmq/core/poll.pyx
+@@ -23,9 +23,8 @@
+ # Imports
+ #-----------------------------------------------------------------------------
+
+-from czmq cimport zmq_poll, zmq_pollitem_t
++from czmq cimport zmq_poll, zmq_pollitem_t, allocate
+ from socket cimport Socket
+-from allocate cimport allocate
+
+ import sys
+ from zmq.core.error import ZMQError
+--- zmq/core/socket.pyx
++++ zmq/core/socket.pyx
+@@ -32,7 +32,6 @@
+ from cpython cimport PyBytes_AsString, PyBytes_Size
+ from cpython cimport Py_DECREF, Py_INCREF
+
+-from allocate cimport allocate
+ from buffers cimport asbuffer_r, frombuffer_r, viewfromobject_r
+
+ from czmq cimport *
+--- zmq/utils/allocate.h
++++ zmq/utils/allocate.h
+@@ -0,0 +1,39 @@
++/*
++A utility to allocate a C array.
++
++This is excerpted from mpi4py's "atimport.h" and is licensed under the BSD license.
++*/
++
++#include "Python.h"
++
++static PyObject * allocate(Py_ssize_t n, void **pp){
++ PyObject *ob;
++ if (n > PY_SSIZE_T_MAX)
++ return PyErr_NoMemory();
++ else if (n < 0) {
++ PyErr_SetString(PyExc_RuntimeError,
++ "memory allocation with negative size");
++ return NULL;
++ }
++#if PY_VERSION_HEX >= 0x02060000
++ ob = PyByteArray_FromStringAndSize(NULL, (n==0) ? 1 : n);
++ if (ob && n==0 && (PyByteArray_Resize(ob, 0) < 0)) {
++ Py_DECREF(ob);
++ return NULL;
++ }
++ if (ob && pp)
++ *pp = (void *)PyByteArray_AS_STRING(ob);
++#else
++ {
++ void *p = PyMem_Malloc(n);
++ if (!p)
++ return PyErr_NoMemory();
++ ob = PyCObject_FromVoidPtr(p, PyMem_Free);
++ if (!ob)
++ PyMem_Free(p);
++ else if (pp)
++ *pp = p;
++ }
++#endif
++ return ob;
++}
+\ No newline at end of file
+--- zmq/utils/allocate.pxd
++++ zmq/utils/allocate.pxd
+@@ -1,40 +0,0 @@
+-"""A utility to allocate a C array.
+-
+-This was copied from mpi4py and is licensed under the BSD license.
+-"""
+-
+-from libc.stdlib cimport free, malloc
+-
+-#-----------------------------------------------------------------------------
+-# Python includes.
+-#-----------------------------------------------------------------------------
+-
+-cdef extern from "Python.h":
+- object PyCObject_FromVoidPtr(void *, void (*)(void*))
+-
+-#-----------------------------------------------------------------------------
+-# Main functions.
+-#-----------------------------------------------------------------------------
+-
+-cdef inline void *memnew(size_t n):
+- """malloc a new memory chunk of a given size."""
+- if n == 0: n = 1
+- return malloc(n)
+-
+-cdef inline void memdel(void *p):
+- """free a chunk of memory allocated with memnew."""
+- if p != NULL: free(p)
+-
+-cdef inline object allocate(size_t n, void **pp):
+- """A wrapper that allocates a C array, but with Python ref-counting."""
+- cdef object cob
+- cdef void *p = memnew(n)
+- if p == NULL:
+- raise MemoryError()
+- try:
+- cob = PyCObject_FromVoidPtr(p, memdel)
+- except:
+- memdel(p)
+- raise
+- pp[0] = p
+- return cob
diff --git a/dev-python/pyzmq/pyzmq-2.0.10.1.ebuild b/dev-python/pyzmq/pyzmq-2.0.10.1.ebuild
index f160e7fa04b3..15115ef65e4c 100644
--- a/dev-python/pyzmq/pyzmq-2.0.10.1.ebuild
+++ b/dev-python/pyzmq/pyzmq-2.0.10.1.ebuild
@@ -1,6 +1,6 @@
# Copyright 1999-2011 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
-# $Header: /var/cvsroot/gentoo-x86/dev-python/pyzmq/pyzmq-2.0.10.1.ebuild,v 1.5 2011/03/07 18:17:29 arfrever Exp $
+# $Header: /var/cvsroot/gentoo-x86/dev-python/pyzmq/pyzmq-2.0.10.1.ebuild,v 1.6 2011/03/07 22:21:10 arfrever Exp $
EAPI="3"
PYTHON_DEPEND="*:2.5"
@@ -21,7 +21,9 @@ IUSE=""
# IUSE="doc"
RDEPEND="net-libs/zeromq"
-DEPEND="${RDEPEND}"
+# dev-python/cython required only as long as pyzmq-2.0.10.1-python-3.2.patch is applied.
+DEPEND="${RDEPEND}
+ dev-python/cython"
# doc? (
# dev-python/setuptools
# >=dev-python/sphinx-0.6
@@ -35,6 +37,7 @@ src_prepare() {
epatch "${FILESDIR}/${P}-python-2.7.patch"
epatch "${FILESDIR}/${P}-python-3.1.patch"
+ epatch "${FILESDIR}/${P}-python-3.2.patch"
}
src_compile() {