From d3f26ece7d4383df0b22fe9c3cb3e695381ec737 Mon Sep 17 00:00:00 2001 From: Dan Klein Date: Mon, 24 Aug 2015 10:51:13 +0300 Subject: Initial push to external_lib migration --- .../python/zmq/backend/cython/__init__.py | 23 +++++ external_libs/python/zmq/backend/cython/_device.py | 7 ++ external_libs/python/zmq/backend/cython/_poll.py | 7 ++ .../python/zmq/backend/cython/_version.py | 7 ++ .../python/zmq/backend/cython/checkrc.pxd | 23 +++++ .../python/zmq/backend/cython/constants.py | 7 ++ .../python/zmq/backend/cython/context.pxd | 41 ++++++++ external_libs/python/zmq/backend/cython/context.py | 7 ++ external_libs/python/zmq/backend/cython/error.py | 7 ++ external_libs/python/zmq/backend/cython/libzmq.pxd | 110 +++++++++++++++++++++ .../python/zmq/backend/cython/message.pxd | 63 ++++++++++++ external_libs/python/zmq/backend/cython/message.py | 7 ++ external_libs/python/zmq/backend/cython/socket.pxd | 47 +++++++++ external_libs/python/zmq/backend/cython/socket.py | 7 ++ external_libs/python/zmq/backend/cython/utils.pxd | 29 ++++++ external_libs/python/zmq/backend/cython/utils.py | 7 ++ 16 files changed, 399 insertions(+) create mode 100644 external_libs/python/zmq/backend/cython/__init__.py create mode 100644 external_libs/python/zmq/backend/cython/_device.py create mode 100644 external_libs/python/zmq/backend/cython/_poll.py create mode 100644 external_libs/python/zmq/backend/cython/_version.py create mode 100644 external_libs/python/zmq/backend/cython/checkrc.pxd create mode 100644 external_libs/python/zmq/backend/cython/constants.py create mode 100644 external_libs/python/zmq/backend/cython/context.pxd create mode 100644 external_libs/python/zmq/backend/cython/context.py create mode 100644 external_libs/python/zmq/backend/cython/error.py create mode 100644 external_libs/python/zmq/backend/cython/libzmq.pxd create mode 100644 external_libs/python/zmq/backend/cython/message.pxd create mode 100644 external_libs/python/zmq/backend/cython/message.py create mode 100644 external_libs/python/zmq/backend/cython/socket.pxd create mode 100644 external_libs/python/zmq/backend/cython/socket.py create mode 100644 external_libs/python/zmq/backend/cython/utils.pxd create mode 100644 external_libs/python/zmq/backend/cython/utils.py (limited to 'external_libs/python/zmq/backend/cython') diff --git a/external_libs/python/zmq/backend/cython/__init__.py b/external_libs/python/zmq/backend/cython/__init__.py new file mode 100644 index 00000000..e5358185 --- /dev/null +++ b/external_libs/python/zmq/backend/cython/__init__.py @@ -0,0 +1,23 @@ +"""Python bindings for core 0MQ objects.""" + +# Copyright (C) PyZMQ Developers +# Distributed under the terms of the Lesser GNU Public License (LGPL). + +from . import (constants, error, message, context, + socket, utils, _poll, _version, _device ) + +__all__ = [] +for submod in (constants, error, message, context, + socket, utils, _poll, _version, _device): + __all__.extend(submod.__all__) + +from .constants import * +from .error import * +from .message import * +from .context import * +from .socket import * +from ._poll import * +from .utils import * +from ._device import * +from ._version import * + diff --git a/external_libs/python/zmq/backend/cython/_device.py b/external_libs/python/zmq/backend/cython/_device.py new file mode 100644 index 00000000..3368ca2c --- /dev/null +++ b/external_libs/python/zmq/backend/cython/_device.py @@ -0,0 +1,7 @@ +def __bootstrap__(): + global __bootstrap__, __loader__, __file__ + import sys, pkg_resources, imp + __file__ = pkg_resources.resource_filename(__name__,'_device.so') + __loader__ = None; del __bootstrap__, __loader__ + imp.load_dynamic(__name__,__file__) +__bootstrap__() diff --git a/external_libs/python/zmq/backend/cython/_poll.py b/external_libs/python/zmq/backend/cython/_poll.py new file mode 100644 index 00000000..cb1d5d77 --- /dev/null +++ b/external_libs/python/zmq/backend/cython/_poll.py @@ -0,0 +1,7 @@ +def __bootstrap__(): + global __bootstrap__, __loader__, __file__ + import sys, pkg_resources, imp + __file__ = pkg_resources.resource_filename(__name__,'_poll.so') + __loader__ = None; del __bootstrap__, __loader__ + imp.load_dynamic(__name__,__file__) +__bootstrap__() diff --git a/external_libs/python/zmq/backend/cython/_version.py b/external_libs/python/zmq/backend/cython/_version.py new file mode 100644 index 00000000..08262706 --- /dev/null +++ b/external_libs/python/zmq/backend/cython/_version.py @@ -0,0 +1,7 @@ +def __bootstrap__(): + global __bootstrap__, __loader__, __file__ + import sys, pkg_resources, imp + __file__ = pkg_resources.resource_filename(__name__,'_version.so') + __loader__ = None; del __bootstrap__, __loader__ + imp.load_dynamic(__name__,__file__) +__bootstrap__() diff --git a/external_libs/python/zmq/backend/cython/checkrc.pxd b/external_libs/python/zmq/backend/cython/checkrc.pxd new file mode 100644 index 00000000..3bf69fc3 --- /dev/null +++ b/external_libs/python/zmq/backend/cython/checkrc.pxd @@ -0,0 +1,23 @@ +from libc.errno cimport EINTR, EAGAIN +from cpython cimport PyErr_CheckSignals +from libzmq cimport zmq_errno, ZMQ_ETERM + +cdef inline int _check_rc(int rc) except -1: + """internal utility for checking zmq return condition + + and raising the appropriate Exception class + """ + cdef int errno = zmq_errno() + PyErr_CheckSignals() + if rc < 0: + if errno == EAGAIN: + from zmq.error import Again + raise Again(errno) + elif errno == ZMQ_ETERM: + from zmq.error import ContextTerminated + raise ContextTerminated(errno) + else: + from zmq.error import ZMQError + raise ZMQError(errno) + # return -1 + return 0 diff --git a/external_libs/python/zmq/backend/cython/constants.py b/external_libs/python/zmq/backend/cython/constants.py new file mode 100644 index 00000000..ea772ac0 --- /dev/null +++ b/external_libs/python/zmq/backend/cython/constants.py @@ -0,0 +1,7 @@ +def __bootstrap__(): + global __bootstrap__, __loader__, __file__ + import sys, pkg_resources, imp + __file__ = pkg_resources.resource_filename(__name__,'constants.so') + __loader__ = None; del __bootstrap__, __loader__ + imp.load_dynamic(__name__,__file__) +__bootstrap__() diff --git a/external_libs/python/zmq/backend/cython/context.pxd b/external_libs/python/zmq/backend/cython/context.pxd new file mode 100644 index 00000000..9c9267a5 --- /dev/null +++ b/external_libs/python/zmq/backend/cython/context.pxd @@ -0,0 +1,41 @@ +"""0MQ Context class declaration.""" + +# +# Copyright (c) 2010-2011 Brian E. Granger & Min Ragan-Kelley +# +# This file is part of pyzmq. +# +# pyzmq is free software; you can redistribute it and/or modify it under +# the terms of the Lesser GNU General Public License as published by +# the Free Software Foundation; either version 3 of the License, or +# (at your option) any later version. +# +# pyzmq is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# Lesser GNU General Public License for more details. +# +# You should have received a copy of the Lesser GNU General Public License +# along with this program. If not, see . +# + +#----------------------------------------------------------------------------- +# Code +#----------------------------------------------------------------------------- + +cdef class Context: + + cdef object __weakref__ # enable weakref + cdef void *handle # The C handle for the underlying zmq object. + cdef bint _shadow # whether the Context is a shadow wrapper of another + cdef void **_sockets # A C-array containg socket handles + cdef size_t _n_sockets # the number of sockets + cdef size_t _max_sockets # the size of the _sockets array + cdef int _pid # the pid of the process which created me (for fork safety) + + cdef public bint closed # bool property for a closed context. + cdef inline int _term(self) + # helpers for events on _sockets in Socket.__cinit__()/close() + cdef inline void _add_socket(self, void* handle) + cdef inline void _remove_socket(self, void* handle) + diff --git a/external_libs/python/zmq/backend/cython/context.py b/external_libs/python/zmq/backend/cython/context.py new file mode 100644 index 00000000..19f8ec7c --- /dev/null +++ b/external_libs/python/zmq/backend/cython/context.py @@ -0,0 +1,7 @@ +def __bootstrap__(): + global __bootstrap__, __loader__, __file__ + import sys, pkg_resources, imp + __file__ = pkg_resources.resource_filename(__name__,'context.so') + __loader__ = None; del __bootstrap__, __loader__ + imp.load_dynamic(__name__,__file__) +__bootstrap__() diff --git a/external_libs/python/zmq/backend/cython/error.py b/external_libs/python/zmq/backend/cython/error.py new file mode 100644 index 00000000..d3a4ea0e --- /dev/null +++ b/external_libs/python/zmq/backend/cython/error.py @@ -0,0 +1,7 @@ +def __bootstrap__(): + global __bootstrap__, __loader__, __file__ + import sys, pkg_resources, imp + __file__ = pkg_resources.resource_filename(__name__,'error.so') + __loader__ = None; del __bootstrap__, __loader__ + imp.load_dynamic(__name__,__file__) +__bootstrap__() diff --git a/external_libs/python/zmq/backend/cython/libzmq.pxd b/external_libs/python/zmq/backend/cython/libzmq.pxd new file mode 100644 index 00000000..e42f6d6b --- /dev/null +++ b/external_libs/python/zmq/backend/cython/libzmq.pxd @@ -0,0 +1,110 @@ +"""All the C imports for 0MQ""" + +# +# Copyright (c) 2010 Brian E. Granger & Min Ragan-Kelley +# +# This file is part of pyzmq. +# +# pyzmq is free software; you can redistribute it and/or modify it under +# the terms of the Lesser GNU General Public License as published by +# the Free Software Foundation; either version 3 of the License, or +# (at your option) any later version. +# +# pyzmq is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# Lesser GNU General Public License for more details. +# +# You should have received a copy of the Lesser GNU General Public License +# along with this program. If not, see . +# + +#----------------------------------------------------------------------------- +# Imports +#----------------------------------------------------------------------------- + +#----------------------------------------------------------------------------- +# Import the C header files +#----------------------------------------------------------------------------- + +cdef extern from *: + ctypedef void* const_void_ptr "const void *" + ctypedef char* const_char_ptr "const char *" + +cdef extern from "zmq_compat.h": + ctypedef signed long long int64_t "pyzmq_int64_t" + +include "constant_enums.pxi" + +cdef extern from "zmq.h" nogil: + + void _zmq_version "zmq_version"(int *major, int *minor, int *patch) + + ctypedef int fd_t "ZMQ_FD_T" + + enum: errno + char *zmq_strerror (int errnum) + int zmq_errno() + + void *zmq_ctx_new () + int zmq_ctx_destroy (void *context) + int zmq_ctx_set (void *context, int option, int optval) + int zmq_ctx_get (void *context, int option) + void *zmq_init (int io_threads) + int zmq_term (void *context) + + # blackbox def for zmq_msg_t + ctypedef void * zmq_msg_t "zmq_msg_t" + + ctypedef void zmq_free_fn(void *data, void *hint) + + int zmq_msg_init (zmq_msg_t *msg) + int zmq_msg_init_size (zmq_msg_t *msg, size_t size) + int zmq_msg_init_data (zmq_msg_t *msg, void *data, + size_t size, zmq_free_fn *ffn, void *hint) + int zmq_msg_send (zmq_msg_t *msg, void *s, int flags) + int zmq_msg_recv (zmq_msg_t *msg, void *s, int flags) + int zmq_msg_close (zmq_msg_t *msg) + int zmq_msg_move (zmq_msg_t *dest, zmq_msg_t *src) + int zmq_msg_copy (zmq_msg_t *dest, zmq_msg_t *src) + void *zmq_msg_data (zmq_msg_t *msg) + size_t zmq_msg_size (zmq_msg_t *msg) + int zmq_msg_more (zmq_msg_t *msg) + int zmq_msg_get (zmq_msg_t *msg, int option) + int zmq_msg_set (zmq_msg_t *msg, int option, int optval) + const_char_ptr zmq_msg_gets (zmq_msg_t *msg, const_char_ptr property) + int zmq_has (const_char_ptr capability) + + void *zmq_socket (void *context, int type) + int zmq_close (void *s) + int zmq_setsockopt (void *s, int option, void *optval, size_t optvallen) + int zmq_getsockopt (void *s, int option, void *optval, size_t *optvallen) + int zmq_bind (void *s, char *addr) + int zmq_connect (void *s, char *addr) + int zmq_unbind (void *s, char *addr) + int zmq_disconnect (void *s, char *addr) + + int zmq_socket_monitor (void *s, char *addr, int flags) + + # send/recv + int zmq_sendbuf (void *s, const_void_ptr buf, size_t n, int flags) + int zmq_recvbuf (void *s, void *buf, size_t n, int flags) + + ctypedef struct zmq_pollitem_t: + void *socket + int fd + short events + short revents + + int zmq_poll (zmq_pollitem_t *items, int nitems, long timeout) + + int zmq_device (int device_, void *insocket_, void *outsocket_) + int zmq_proxy (void *frontend, void *backend, void *capture) + +cdef extern from "zmq_utils.h" nogil: + + void *zmq_stopwatch_start () + unsigned long zmq_stopwatch_stop (void *watch_) + void zmq_sleep (int seconds_) + int zmq_curve_keypair (char *z85_public_key, char *z85_secret_key) + diff --git a/external_libs/python/zmq/backend/cython/message.pxd b/external_libs/python/zmq/backend/cython/message.pxd new file mode 100644 index 00000000..4781195f --- /dev/null +++ b/external_libs/python/zmq/backend/cython/message.pxd @@ -0,0 +1,63 @@ +"""0MQ Message related class declarations.""" + +# +# Copyright (c) 2010-2011 Brian E. Granger & Min Ragan-Kelley +# +# This file is part of pyzmq. +# +# pyzmq is free software; you can redistribute it and/or modify it under +# the terms of the Lesser GNU General Public License as published by +# the Free Software Foundation; either version 3 of the License, or +# (at your option) any later version. +# +# pyzmq is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# Lesser GNU General Public License for more details. +# +# You should have received a copy of the Lesser GNU General Public License +# along with this program. If not, see . +# + +#----------------------------------------------------------------------------- +# Imports +#----------------------------------------------------------------------------- + +from cpython cimport PyBytes_FromStringAndSize + +from libzmq cimport zmq_msg_t, zmq_msg_data, zmq_msg_size + +#----------------------------------------------------------------------------- +# Code +#----------------------------------------------------------------------------- + +cdef class MessageTracker(object): + + cdef set events # Message Event objects to track. + cdef set peers # Other Message or MessageTracker objects. + + +cdef class Frame: + + cdef zmq_msg_t zmq_msg + cdef object _data # The actual message data as a Python object. + cdef object _buffer # A Python Buffer/View of the message contents + cdef object _bytes # A bytes/str copy of the message. + cdef bint _failed_init # Flag to handle failed zmq_msg_init + cdef public object tracker_event # Event for use with zmq_free_fn. + cdef public object tracker # MessageTracker object. + cdef public bint more # whether RCVMORE was set + + cdef Frame fast_copy(self) # Create shallow copy of Message object. + cdef object _getbuffer(self) # Construct self._buffer. + + +cdef inline object copy_zmq_msg_bytes(zmq_msg_t *zmq_msg): + """ Copy the data from a zmq_msg_t """ + cdef char *data_c = NULL + cdef Py_ssize_t data_len_c + data_c = zmq_msg_data(zmq_msg) + data_len_c = zmq_msg_size(zmq_msg) + return PyBytes_FromStringAndSize(data_c, data_len_c) + + diff --git a/external_libs/python/zmq/backend/cython/message.py b/external_libs/python/zmq/backend/cython/message.py new file mode 100644 index 00000000..5e423b62 --- /dev/null +++ b/external_libs/python/zmq/backend/cython/message.py @@ -0,0 +1,7 @@ +def __bootstrap__(): + global __bootstrap__, __loader__, __file__ + import sys, pkg_resources, imp + __file__ = pkg_resources.resource_filename(__name__,'message.so') + __loader__ = None; del __bootstrap__, __loader__ + imp.load_dynamic(__name__,__file__) +__bootstrap__() diff --git a/external_libs/python/zmq/backend/cython/socket.pxd b/external_libs/python/zmq/backend/cython/socket.pxd new file mode 100644 index 00000000..b8a331e2 --- /dev/null +++ b/external_libs/python/zmq/backend/cython/socket.pxd @@ -0,0 +1,47 @@ +"""0MQ Socket class declaration.""" + +# +# Copyright (c) 2010-2011 Brian E. Granger & Min Ragan-Kelley +# +# This file is part of pyzmq. +# +# pyzmq is free software; you can redistribute it and/or modify it under +# the terms of the Lesser GNU General Public License as published by +# the Free Software Foundation; either version 3 of the License, or +# (at your option) any later version. +# +# pyzmq is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# Lesser GNU General Public License for more details. +# +# You should have received a copy of the Lesser GNU General Public License +# along with this program. If not, see . +# + +#----------------------------------------------------------------------------- +# Imports +#----------------------------------------------------------------------------- + +from context cimport Context + +#----------------------------------------------------------------------------- +# Code +#----------------------------------------------------------------------------- + + +cdef class Socket: + + cdef object __weakref__ # enable weakref + cdef void *handle # The C handle for the underlying zmq object. + cdef bint _shadow # whether the Socket is a shadow wrapper of another + # Hold on to a reference to the context to make sure it is not garbage + # collected until the socket it done with it. + cdef public Context context # The zmq Context object that owns this. + cdef public bint _closed # bool property for a closed socket. + cdef int _pid # the pid of the process which created me (for fork safety) + + # cpdef methods for direct-cython access: + cpdef object send(self, object data, int flags=*, copy=*, track=*) + cpdef object recv(self, int flags=*, copy=*, track=*) + diff --git a/external_libs/python/zmq/backend/cython/socket.py b/external_libs/python/zmq/backend/cython/socket.py new file mode 100644 index 00000000..faef8bee --- /dev/null +++ b/external_libs/python/zmq/backend/cython/socket.py @@ -0,0 +1,7 @@ +def __bootstrap__(): + global __bootstrap__, __loader__, __file__ + import sys, pkg_resources, imp + __file__ = pkg_resources.resource_filename(__name__,'socket.so') + __loader__ = None; del __bootstrap__, __loader__ + imp.load_dynamic(__name__,__file__) +__bootstrap__() diff --git a/external_libs/python/zmq/backend/cython/utils.pxd b/external_libs/python/zmq/backend/cython/utils.pxd new file mode 100644 index 00000000..1d7117f1 --- /dev/null +++ b/external_libs/python/zmq/backend/cython/utils.pxd @@ -0,0 +1,29 @@ +"""Wrap zmq_utils.h""" + +# +# Copyright (c) 2010 Brian E. Granger & Min Ragan-Kelley +# +# This file is part of pyzmq. +# +# pyzmq is free software; you can redistribute it and/or modify it under +# the terms of the Lesser GNU General Public License as published by +# the Free Software Foundation; either version 3 of the License, or +# (at your option) any later version. +# +# pyzmq is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# Lesser GNU General Public License for more details. +# +# You should have received a copy of the Lesser GNU General Public License +# along with this program. If not, see . +# + +#----------------------------------------------------------------------------- +# Code +#----------------------------------------------------------------------------- + + +cdef class Stopwatch: + cdef void *watch # The C handle for the underlying zmq object + diff --git a/external_libs/python/zmq/backend/cython/utils.py b/external_libs/python/zmq/backend/cython/utils.py new file mode 100644 index 00000000..fe928300 --- /dev/null +++ b/external_libs/python/zmq/backend/cython/utils.py @@ -0,0 +1,7 @@ +def __bootstrap__(): + global __bootstrap__, __loader__, __file__ + import sys, pkg_resources, imp + __file__ = pkg_resources.resource_filename(__name__,'utils.so') + __loader__ = None; del __bootstrap__, __loader__ + imp.load_dynamic(__name__,__file__) +__bootstrap__() -- cgit From dab741a80699f86e86c91718872a052cca9bbb25 Mon Sep 17 00:00:00 2001 From: Dan Klein Date: Mon, 24 Aug 2015 13:22:48 +0300 Subject: Fixed dependencies of Control Plane to use external_lib sources --- .../python/zmq/backend/cython/__init__.py | 23 ----- external_libs/python/zmq/backend/cython/_device.py | 7 -- external_libs/python/zmq/backend/cython/_poll.py | 7 -- .../python/zmq/backend/cython/_version.py | 7 -- .../python/zmq/backend/cython/checkrc.pxd | 23 ----- .../python/zmq/backend/cython/constants.py | 7 -- .../python/zmq/backend/cython/context.pxd | 41 -------- external_libs/python/zmq/backend/cython/context.py | 7 -- external_libs/python/zmq/backend/cython/error.py | 7 -- external_libs/python/zmq/backend/cython/libzmq.pxd | 110 --------------------- .../python/zmq/backend/cython/message.pxd | 63 ------------ external_libs/python/zmq/backend/cython/message.py | 7 -- external_libs/python/zmq/backend/cython/socket.pxd | 47 --------- external_libs/python/zmq/backend/cython/socket.py | 7 -- external_libs/python/zmq/backend/cython/utils.pxd | 29 ------ external_libs/python/zmq/backend/cython/utils.py | 7 -- 16 files changed, 399 deletions(-) delete mode 100644 external_libs/python/zmq/backend/cython/__init__.py delete mode 100644 external_libs/python/zmq/backend/cython/_device.py delete mode 100644 external_libs/python/zmq/backend/cython/_poll.py delete mode 100644 external_libs/python/zmq/backend/cython/_version.py delete mode 100644 external_libs/python/zmq/backend/cython/checkrc.pxd delete mode 100644 external_libs/python/zmq/backend/cython/constants.py delete mode 100644 external_libs/python/zmq/backend/cython/context.pxd delete mode 100644 external_libs/python/zmq/backend/cython/context.py delete mode 100644 external_libs/python/zmq/backend/cython/error.py delete mode 100644 external_libs/python/zmq/backend/cython/libzmq.pxd delete mode 100644 external_libs/python/zmq/backend/cython/message.pxd delete mode 100644 external_libs/python/zmq/backend/cython/message.py delete mode 100644 external_libs/python/zmq/backend/cython/socket.pxd delete mode 100644 external_libs/python/zmq/backend/cython/socket.py delete mode 100644 external_libs/python/zmq/backend/cython/utils.pxd delete mode 100644 external_libs/python/zmq/backend/cython/utils.py (limited to 'external_libs/python/zmq/backend/cython') diff --git a/external_libs/python/zmq/backend/cython/__init__.py b/external_libs/python/zmq/backend/cython/__init__.py deleted file mode 100644 index e5358185..00000000 --- a/external_libs/python/zmq/backend/cython/__init__.py +++ /dev/null @@ -1,23 +0,0 @@ -"""Python bindings for core 0MQ objects.""" - -# Copyright (C) PyZMQ Developers -# Distributed under the terms of the Lesser GNU Public License (LGPL). - -from . import (constants, error, message, context, - socket, utils, _poll, _version, _device ) - -__all__ = [] -for submod in (constants, error, message, context, - socket, utils, _poll, _version, _device): - __all__.extend(submod.__all__) - -from .constants import * -from .error import * -from .message import * -from .context import * -from .socket import * -from ._poll import * -from .utils import * -from ._device import * -from ._version import * - diff --git a/external_libs/python/zmq/backend/cython/_device.py b/external_libs/python/zmq/backend/cython/_device.py deleted file mode 100644 index 3368ca2c..00000000 --- a/external_libs/python/zmq/backend/cython/_device.py +++ /dev/null @@ -1,7 +0,0 @@ -def __bootstrap__(): - global __bootstrap__, __loader__, __file__ - import sys, pkg_resources, imp - __file__ = pkg_resources.resource_filename(__name__,'_device.so') - __loader__ = None; del __bootstrap__, __loader__ - imp.load_dynamic(__name__,__file__) -__bootstrap__() diff --git a/external_libs/python/zmq/backend/cython/_poll.py b/external_libs/python/zmq/backend/cython/_poll.py deleted file mode 100644 index cb1d5d77..00000000 --- a/external_libs/python/zmq/backend/cython/_poll.py +++ /dev/null @@ -1,7 +0,0 @@ -def __bootstrap__(): - global __bootstrap__, __loader__, __file__ - import sys, pkg_resources, imp - __file__ = pkg_resources.resource_filename(__name__,'_poll.so') - __loader__ = None; del __bootstrap__, __loader__ - imp.load_dynamic(__name__,__file__) -__bootstrap__() diff --git a/external_libs/python/zmq/backend/cython/_version.py b/external_libs/python/zmq/backend/cython/_version.py deleted file mode 100644 index 08262706..00000000 --- a/external_libs/python/zmq/backend/cython/_version.py +++ /dev/null @@ -1,7 +0,0 @@ -def __bootstrap__(): - global __bootstrap__, __loader__, __file__ - import sys, pkg_resources, imp - __file__ = pkg_resources.resource_filename(__name__,'_version.so') - __loader__ = None; del __bootstrap__, __loader__ - imp.load_dynamic(__name__,__file__) -__bootstrap__() diff --git a/external_libs/python/zmq/backend/cython/checkrc.pxd b/external_libs/python/zmq/backend/cython/checkrc.pxd deleted file mode 100644 index 3bf69fc3..00000000 --- a/external_libs/python/zmq/backend/cython/checkrc.pxd +++ /dev/null @@ -1,23 +0,0 @@ -from libc.errno cimport EINTR, EAGAIN -from cpython cimport PyErr_CheckSignals -from libzmq cimport zmq_errno, ZMQ_ETERM - -cdef inline int _check_rc(int rc) except -1: - """internal utility for checking zmq return condition - - and raising the appropriate Exception class - """ - cdef int errno = zmq_errno() - PyErr_CheckSignals() - if rc < 0: - if errno == EAGAIN: - from zmq.error import Again - raise Again(errno) - elif errno == ZMQ_ETERM: - from zmq.error import ContextTerminated - raise ContextTerminated(errno) - else: - from zmq.error import ZMQError - raise ZMQError(errno) - # return -1 - return 0 diff --git a/external_libs/python/zmq/backend/cython/constants.py b/external_libs/python/zmq/backend/cython/constants.py deleted file mode 100644 index ea772ac0..00000000 --- a/external_libs/python/zmq/backend/cython/constants.py +++ /dev/null @@ -1,7 +0,0 @@ -def __bootstrap__(): - global __bootstrap__, __loader__, __file__ - import sys, pkg_resources, imp - __file__ = pkg_resources.resource_filename(__name__,'constants.so') - __loader__ = None; del __bootstrap__, __loader__ - imp.load_dynamic(__name__,__file__) -__bootstrap__() diff --git a/external_libs/python/zmq/backend/cython/context.pxd b/external_libs/python/zmq/backend/cython/context.pxd deleted file mode 100644 index 9c9267a5..00000000 --- a/external_libs/python/zmq/backend/cython/context.pxd +++ /dev/null @@ -1,41 +0,0 @@ -"""0MQ Context class declaration.""" - -# -# Copyright (c) 2010-2011 Brian E. Granger & Min Ragan-Kelley -# -# This file is part of pyzmq. -# -# pyzmq is free software; you can redistribute it and/or modify it under -# the terms of the Lesser GNU General Public License as published by -# the Free Software Foundation; either version 3 of the License, or -# (at your option) any later version. -# -# pyzmq is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# Lesser GNU General Public License for more details. -# -# You should have received a copy of the Lesser GNU General Public License -# along with this program. If not, see . -# - -#----------------------------------------------------------------------------- -# Code -#----------------------------------------------------------------------------- - -cdef class Context: - - cdef object __weakref__ # enable weakref - cdef void *handle # The C handle for the underlying zmq object. - cdef bint _shadow # whether the Context is a shadow wrapper of another - cdef void **_sockets # A C-array containg socket handles - cdef size_t _n_sockets # the number of sockets - cdef size_t _max_sockets # the size of the _sockets array - cdef int _pid # the pid of the process which created me (for fork safety) - - cdef public bint closed # bool property for a closed context. - cdef inline int _term(self) - # helpers for events on _sockets in Socket.__cinit__()/close() - cdef inline void _add_socket(self, void* handle) - cdef inline void _remove_socket(self, void* handle) - diff --git a/external_libs/python/zmq/backend/cython/context.py b/external_libs/python/zmq/backend/cython/context.py deleted file mode 100644 index 19f8ec7c..00000000 --- a/external_libs/python/zmq/backend/cython/context.py +++ /dev/null @@ -1,7 +0,0 @@ -def __bootstrap__(): - global __bootstrap__, __loader__, __file__ - import sys, pkg_resources, imp - __file__ = pkg_resources.resource_filename(__name__,'context.so') - __loader__ = None; del __bootstrap__, __loader__ - imp.load_dynamic(__name__,__file__) -__bootstrap__() diff --git a/external_libs/python/zmq/backend/cython/error.py b/external_libs/python/zmq/backend/cython/error.py deleted file mode 100644 index d3a4ea0e..00000000 --- a/external_libs/python/zmq/backend/cython/error.py +++ /dev/null @@ -1,7 +0,0 @@ -def __bootstrap__(): - global __bootstrap__, __loader__, __file__ - import sys, pkg_resources, imp - __file__ = pkg_resources.resource_filename(__name__,'error.so') - __loader__ = None; del __bootstrap__, __loader__ - imp.load_dynamic(__name__,__file__) -__bootstrap__() diff --git a/external_libs/python/zmq/backend/cython/libzmq.pxd b/external_libs/python/zmq/backend/cython/libzmq.pxd deleted file mode 100644 index e42f6d6b..00000000 --- a/external_libs/python/zmq/backend/cython/libzmq.pxd +++ /dev/null @@ -1,110 +0,0 @@ -"""All the C imports for 0MQ""" - -# -# Copyright (c) 2010 Brian E. Granger & Min Ragan-Kelley -# -# This file is part of pyzmq. -# -# pyzmq is free software; you can redistribute it and/or modify it under -# the terms of the Lesser GNU General Public License as published by -# the Free Software Foundation; either version 3 of the License, or -# (at your option) any later version. -# -# pyzmq is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# Lesser GNU General Public License for more details. -# -# You should have received a copy of the Lesser GNU General Public License -# along with this program. If not, see . -# - -#----------------------------------------------------------------------------- -# Imports -#----------------------------------------------------------------------------- - -#----------------------------------------------------------------------------- -# Import the C header files -#----------------------------------------------------------------------------- - -cdef extern from *: - ctypedef void* const_void_ptr "const void *" - ctypedef char* const_char_ptr "const char *" - -cdef extern from "zmq_compat.h": - ctypedef signed long long int64_t "pyzmq_int64_t" - -include "constant_enums.pxi" - -cdef extern from "zmq.h" nogil: - - void _zmq_version "zmq_version"(int *major, int *minor, int *patch) - - ctypedef int fd_t "ZMQ_FD_T" - - enum: errno - char *zmq_strerror (int errnum) - int zmq_errno() - - void *zmq_ctx_new () - int zmq_ctx_destroy (void *context) - int zmq_ctx_set (void *context, int option, int optval) - int zmq_ctx_get (void *context, int option) - void *zmq_init (int io_threads) - int zmq_term (void *context) - - # blackbox def for zmq_msg_t - ctypedef void * zmq_msg_t "zmq_msg_t" - - ctypedef void zmq_free_fn(void *data, void *hint) - - int zmq_msg_init (zmq_msg_t *msg) - int zmq_msg_init_size (zmq_msg_t *msg, size_t size) - int zmq_msg_init_data (zmq_msg_t *msg, void *data, - size_t size, zmq_free_fn *ffn, void *hint) - int zmq_msg_send (zmq_msg_t *msg, void *s, int flags) - int zmq_msg_recv (zmq_msg_t *msg, void *s, int flags) - int zmq_msg_close (zmq_msg_t *msg) - int zmq_msg_move (zmq_msg_t *dest, zmq_msg_t *src) - int zmq_msg_copy (zmq_msg_t *dest, zmq_msg_t *src) - void *zmq_msg_data (zmq_msg_t *msg) - size_t zmq_msg_size (zmq_msg_t *msg) - int zmq_msg_more (zmq_msg_t *msg) - int zmq_msg_get (zmq_msg_t *msg, int option) - int zmq_msg_set (zmq_msg_t *msg, int option, int optval) - const_char_ptr zmq_msg_gets (zmq_msg_t *msg, const_char_ptr property) - int zmq_has (const_char_ptr capability) - - void *zmq_socket (void *context, int type) - int zmq_close (void *s) - int zmq_setsockopt (void *s, int option, void *optval, size_t optvallen) - int zmq_getsockopt (void *s, int option, void *optval, size_t *optvallen) - int zmq_bind (void *s, char *addr) - int zmq_connect (void *s, char *addr) - int zmq_unbind (void *s, char *addr) - int zmq_disconnect (void *s, char *addr) - - int zmq_socket_monitor (void *s, char *addr, int flags) - - # send/recv - int zmq_sendbuf (void *s, const_void_ptr buf, size_t n, int flags) - int zmq_recvbuf (void *s, void *buf, size_t n, int flags) - - ctypedef struct zmq_pollitem_t: - void *socket - int fd - short events - short revents - - int zmq_poll (zmq_pollitem_t *items, int nitems, long timeout) - - int zmq_device (int device_, void *insocket_, void *outsocket_) - int zmq_proxy (void *frontend, void *backend, void *capture) - -cdef extern from "zmq_utils.h" nogil: - - void *zmq_stopwatch_start () - unsigned long zmq_stopwatch_stop (void *watch_) - void zmq_sleep (int seconds_) - int zmq_curve_keypair (char *z85_public_key, char *z85_secret_key) - diff --git a/external_libs/python/zmq/backend/cython/message.pxd b/external_libs/python/zmq/backend/cython/message.pxd deleted file mode 100644 index 4781195f..00000000 --- a/external_libs/python/zmq/backend/cython/message.pxd +++ /dev/null @@ -1,63 +0,0 @@ -"""0MQ Message related class declarations.""" - -# -# Copyright (c) 2010-2011 Brian E. Granger & Min Ragan-Kelley -# -# This file is part of pyzmq. -# -# pyzmq is free software; you can redistribute it and/or modify it under -# the terms of the Lesser GNU General Public License as published by -# the Free Software Foundation; either version 3 of the License, or -# (at your option) any later version. -# -# pyzmq is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# Lesser GNU General Public License for more details. -# -# You should have received a copy of the Lesser GNU General Public License -# along with this program. If not, see . -# - -#----------------------------------------------------------------------------- -# Imports -#----------------------------------------------------------------------------- - -from cpython cimport PyBytes_FromStringAndSize - -from libzmq cimport zmq_msg_t, zmq_msg_data, zmq_msg_size - -#----------------------------------------------------------------------------- -# Code -#----------------------------------------------------------------------------- - -cdef class MessageTracker(object): - - cdef set events # Message Event objects to track. - cdef set peers # Other Message or MessageTracker objects. - - -cdef class Frame: - - cdef zmq_msg_t zmq_msg - cdef object _data # The actual message data as a Python object. - cdef object _buffer # A Python Buffer/View of the message contents - cdef object _bytes # A bytes/str copy of the message. - cdef bint _failed_init # Flag to handle failed zmq_msg_init - cdef public object tracker_event # Event for use with zmq_free_fn. - cdef public object tracker # MessageTracker object. - cdef public bint more # whether RCVMORE was set - - cdef Frame fast_copy(self) # Create shallow copy of Message object. - cdef object _getbuffer(self) # Construct self._buffer. - - -cdef inline object copy_zmq_msg_bytes(zmq_msg_t *zmq_msg): - """ Copy the data from a zmq_msg_t """ - cdef char *data_c = NULL - cdef Py_ssize_t data_len_c - data_c = zmq_msg_data(zmq_msg) - data_len_c = zmq_msg_size(zmq_msg) - return PyBytes_FromStringAndSize(data_c, data_len_c) - - diff --git a/external_libs/python/zmq/backend/cython/message.py b/external_libs/python/zmq/backend/cython/message.py deleted file mode 100644 index 5e423b62..00000000 --- a/external_libs/python/zmq/backend/cython/message.py +++ /dev/null @@ -1,7 +0,0 @@ -def __bootstrap__(): - global __bootstrap__, __loader__, __file__ - import sys, pkg_resources, imp - __file__ = pkg_resources.resource_filename(__name__,'message.so') - __loader__ = None; del __bootstrap__, __loader__ - imp.load_dynamic(__name__,__file__) -__bootstrap__() diff --git a/external_libs/python/zmq/backend/cython/socket.pxd b/external_libs/python/zmq/backend/cython/socket.pxd deleted file mode 100644 index b8a331e2..00000000 --- a/external_libs/python/zmq/backend/cython/socket.pxd +++ /dev/null @@ -1,47 +0,0 @@ -"""0MQ Socket class declaration.""" - -# -# Copyright (c) 2010-2011 Brian E. Granger & Min Ragan-Kelley -# -# This file is part of pyzmq. -# -# pyzmq is free software; you can redistribute it and/or modify it under -# the terms of the Lesser GNU General Public License as published by -# the Free Software Foundation; either version 3 of the License, or -# (at your option) any later version. -# -# pyzmq is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# Lesser GNU General Public License for more details. -# -# You should have received a copy of the Lesser GNU General Public License -# along with this program. If not, see . -# - -#----------------------------------------------------------------------------- -# Imports -#----------------------------------------------------------------------------- - -from context cimport Context - -#----------------------------------------------------------------------------- -# Code -#----------------------------------------------------------------------------- - - -cdef class Socket: - - cdef object __weakref__ # enable weakref - cdef void *handle # The C handle for the underlying zmq object. - cdef bint _shadow # whether the Socket is a shadow wrapper of another - # Hold on to a reference to the context to make sure it is not garbage - # collected until the socket it done with it. - cdef public Context context # The zmq Context object that owns this. - cdef public bint _closed # bool property for a closed socket. - cdef int _pid # the pid of the process which created me (for fork safety) - - # cpdef methods for direct-cython access: - cpdef object send(self, object data, int flags=*, copy=*, track=*) - cpdef object recv(self, int flags=*, copy=*, track=*) - diff --git a/external_libs/python/zmq/backend/cython/socket.py b/external_libs/python/zmq/backend/cython/socket.py deleted file mode 100644 index faef8bee..00000000 --- a/external_libs/python/zmq/backend/cython/socket.py +++ /dev/null @@ -1,7 +0,0 @@ -def __bootstrap__(): - global __bootstrap__, __loader__, __file__ - import sys, pkg_resources, imp - __file__ = pkg_resources.resource_filename(__name__,'socket.so') - __loader__ = None; del __bootstrap__, __loader__ - imp.load_dynamic(__name__,__file__) -__bootstrap__() diff --git a/external_libs/python/zmq/backend/cython/utils.pxd b/external_libs/python/zmq/backend/cython/utils.pxd deleted file mode 100644 index 1d7117f1..00000000 --- a/external_libs/python/zmq/backend/cython/utils.pxd +++ /dev/null @@ -1,29 +0,0 @@ -"""Wrap zmq_utils.h""" - -# -# Copyright (c) 2010 Brian E. Granger & Min Ragan-Kelley -# -# This file is part of pyzmq. -# -# pyzmq is free software; you can redistribute it and/or modify it under -# the terms of the Lesser GNU General Public License as published by -# the Free Software Foundation; either version 3 of the License, or -# (at your option) any later version. -# -# pyzmq is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# Lesser GNU General Public License for more details. -# -# You should have received a copy of the Lesser GNU General Public License -# along with this program. If not, see . -# - -#----------------------------------------------------------------------------- -# Code -#----------------------------------------------------------------------------- - - -cdef class Stopwatch: - cdef void *watch # The C handle for the underlying zmq object - diff --git a/external_libs/python/zmq/backend/cython/utils.py b/external_libs/python/zmq/backend/cython/utils.py deleted file mode 100644 index fe928300..00000000 --- a/external_libs/python/zmq/backend/cython/utils.py +++ /dev/null @@ -1,7 +0,0 @@ -def __bootstrap__(): - global __bootstrap__, __loader__, __file__ - import sys, pkg_resources, imp - __file__ = pkg_resources.resource_filename(__name__,'utils.so') - __loader__ = None; del __bootstrap__, __loader__ - imp.load_dynamic(__name__,__file__) -__bootstrap__() -- cgit From 7d3be8c612e295820649779335288c197b80ccb2 Mon Sep 17 00:00:00 2001 From: Dan Klein Date: Mon, 24 Aug 2015 17:28:17 +0300 Subject: Changes location of console and fixed dependencies --- .../python/zmq/backend/cython/__init__.py | 23 +++++ external_libs/python/zmq/backend/cython/_device.py | 7 ++ external_libs/python/zmq/backend/cython/_poll.py | 7 ++ .../python/zmq/backend/cython/_version.py | 7 ++ .../python/zmq/backend/cython/checkrc.pxd | 23 +++++ .../python/zmq/backend/cython/constants.py | 7 ++ .../python/zmq/backend/cython/context.pxd | 41 ++++++++ external_libs/python/zmq/backend/cython/context.py | 7 ++ external_libs/python/zmq/backend/cython/error.py | 7 ++ external_libs/python/zmq/backend/cython/libzmq.pxd | 110 +++++++++++++++++++++ .../python/zmq/backend/cython/message.pxd | 63 ++++++++++++ external_libs/python/zmq/backend/cython/message.py | 7 ++ external_libs/python/zmq/backend/cython/socket.pxd | 47 +++++++++ external_libs/python/zmq/backend/cython/socket.py | 7 ++ external_libs/python/zmq/backend/cython/utils.pxd | 29 ++++++ external_libs/python/zmq/backend/cython/utils.py | 7 ++ 16 files changed, 399 insertions(+) create mode 100644 external_libs/python/zmq/backend/cython/__init__.py create mode 100644 external_libs/python/zmq/backend/cython/_device.py create mode 100644 external_libs/python/zmq/backend/cython/_poll.py create mode 100644 external_libs/python/zmq/backend/cython/_version.py create mode 100644 external_libs/python/zmq/backend/cython/checkrc.pxd create mode 100644 external_libs/python/zmq/backend/cython/constants.py create mode 100644 external_libs/python/zmq/backend/cython/context.pxd create mode 100644 external_libs/python/zmq/backend/cython/context.py create mode 100644 external_libs/python/zmq/backend/cython/error.py create mode 100644 external_libs/python/zmq/backend/cython/libzmq.pxd create mode 100644 external_libs/python/zmq/backend/cython/message.pxd create mode 100644 external_libs/python/zmq/backend/cython/message.py create mode 100644 external_libs/python/zmq/backend/cython/socket.pxd create mode 100644 external_libs/python/zmq/backend/cython/socket.py create mode 100644 external_libs/python/zmq/backend/cython/utils.pxd create mode 100644 external_libs/python/zmq/backend/cython/utils.py (limited to 'external_libs/python/zmq/backend/cython') diff --git a/external_libs/python/zmq/backend/cython/__init__.py b/external_libs/python/zmq/backend/cython/__init__.py new file mode 100644 index 00000000..e5358185 --- /dev/null +++ b/external_libs/python/zmq/backend/cython/__init__.py @@ -0,0 +1,23 @@ +"""Python bindings for core 0MQ objects.""" + +# Copyright (C) PyZMQ Developers +# Distributed under the terms of the Lesser GNU Public License (LGPL). + +from . import (constants, error, message, context, + socket, utils, _poll, _version, _device ) + +__all__ = [] +for submod in (constants, error, message, context, + socket, utils, _poll, _version, _device): + __all__.extend(submod.__all__) + +from .constants import * +from .error import * +from .message import * +from .context import * +from .socket import * +from ._poll import * +from .utils import * +from ._device import * +from ._version import * + diff --git a/external_libs/python/zmq/backend/cython/_device.py b/external_libs/python/zmq/backend/cython/_device.py new file mode 100644 index 00000000..3368ca2c --- /dev/null +++ b/external_libs/python/zmq/backend/cython/_device.py @@ -0,0 +1,7 @@ +def __bootstrap__(): + global __bootstrap__, __loader__, __file__ + import sys, pkg_resources, imp + __file__ = pkg_resources.resource_filename(__name__,'_device.so') + __loader__ = None; del __bootstrap__, __loader__ + imp.load_dynamic(__name__,__file__) +__bootstrap__() diff --git a/external_libs/python/zmq/backend/cython/_poll.py b/external_libs/python/zmq/backend/cython/_poll.py new file mode 100644 index 00000000..cb1d5d77 --- /dev/null +++ b/external_libs/python/zmq/backend/cython/_poll.py @@ -0,0 +1,7 @@ +def __bootstrap__(): + global __bootstrap__, __loader__, __file__ + import sys, pkg_resources, imp + __file__ = pkg_resources.resource_filename(__name__,'_poll.so') + __loader__ = None; del __bootstrap__, __loader__ + imp.load_dynamic(__name__,__file__) +__bootstrap__() diff --git a/external_libs/python/zmq/backend/cython/_version.py b/external_libs/python/zmq/backend/cython/_version.py new file mode 100644 index 00000000..08262706 --- /dev/null +++ b/external_libs/python/zmq/backend/cython/_version.py @@ -0,0 +1,7 @@ +def __bootstrap__(): + global __bootstrap__, __loader__, __file__ + import sys, pkg_resources, imp + __file__ = pkg_resources.resource_filename(__name__,'_version.so') + __loader__ = None; del __bootstrap__, __loader__ + imp.load_dynamic(__name__,__file__) +__bootstrap__() diff --git a/external_libs/python/zmq/backend/cython/checkrc.pxd b/external_libs/python/zmq/backend/cython/checkrc.pxd new file mode 100644 index 00000000..3bf69fc3 --- /dev/null +++ b/external_libs/python/zmq/backend/cython/checkrc.pxd @@ -0,0 +1,23 @@ +from libc.errno cimport EINTR, EAGAIN +from cpython cimport PyErr_CheckSignals +from libzmq cimport zmq_errno, ZMQ_ETERM + +cdef inline int _check_rc(int rc) except -1: + """internal utility for checking zmq return condition + + and raising the appropriate Exception class + """ + cdef int errno = zmq_errno() + PyErr_CheckSignals() + if rc < 0: + if errno == EAGAIN: + from zmq.error import Again + raise Again(errno) + elif errno == ZMQ_ETERM: + from zmq.error import ContextTerminated + raise ContextTerminated(errno) + else: + from zmq.error import ZMQError + raise ZMQError(errno) + # return -1 + return 0 diff --git a/external_libs/python/zmq/backend/cython/constants.py b/external_libs/python/zmq/backend/cython/constants.py new file mode 100644 index 00000000..ea772ac0 --- /dev/null +++ b/external_libs/python/zmq/backend/cython/constants.py @@ -0,0 +1,7 @@ +def __bootstrap__(): + global __bootstrap__, __loader__, __file__ + import sys, pkg_resources, imp + __file__ = pkg_resources.resource_filename(__name__,'constants.so') + __loader__ = None; del __bootstrap__, __loader__ + imp.load_dynamic(__name__,__file__) +__bootstrap__() diff --git a/external_libs/python/zmq/backend/cython/context.pxd b/external_libs/python/zmq/backend/cython/context.pxd new file mode 100644 index 00000000..9c9267a5 --- /dev/null +++ b/external_libs/python/zmq/backend/cython/context.pxd @@ -0,0 +1,41 @@ +"""0MQ Context class declaration.""" + +# +# Copyright (c) 2010-2011 Brian E. Granger & Min Ragan-Kelley +# +# This file is part of pyzmq. +# +# pyzmq is free software; you can redistribute it and/or modify it under +# the terms of the Lesser GNU General Public License as published by +# the Free Software Foundation; either version 3 of the License, or +# (at your option) any later version. +# +# pyzmq is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# Lesser GNU General Public License for more details. +# +# You should have received a copy of the Lesser GNU General Public License +# along with this program. If not, see . +# + +#----------------------------------------------------------------------------- +# Code +#----------------------------------------------------------------------------- + +cdef class Context: + + cdef object __weakref__ # enable weakref + cdef void *handle # The C handle for the underlying zmq object. + cdef bint _shadow # whether the Context is a shadow wrapper of another + cdef void **_sockets # A C-array containg socket handles + cdef size_t _n_sockets # the number of sockets + cdef size_t _max_sockets # the size of the _sockets array + cdef int _pid # the pid of the process which created me (for fork safety) + + cdef public bint closed # bool property for a closed context. + cdef inline int _term(self) + # helpers for events on _sockets in Socket.__cinit__()/close() + cdef inline void _add_socket(self, void* handle) + cdef inline void _remove_socket(self, void* handle) + diff --git a/external_libs/python/zmq/backend/cython/context.py b/external_libs/python/zmq/backend/cython/context.py new file mode 100644 index 00000000..19f8ec7c --- /dev/null +++ b/external_libs/python/zmq/backend/cython/context.py @@ -0,0 +1,7 @@ +def __bootstrap__(): + global __bootstrap__, __loader__, __file__ + import sys, pkg_resources, imp + __file__ = pkg_resources.resource_filename(__name__,'context.so') + __loader__ = None; del __bootstrap__, __loader__ + imp.load_dynamic(__name__,__file__) +__bootstrap__() diff --git a/external_libs/python/zmq/backend/cython/error.py b/external_libs/python/zmq/backend/cython/error.py new file mode 100644 index 00000000..d3a4ea0e --- /dev/null +++ b/external_libs/python/zmq/backend/cython/error.py @@ -0,0 +1,7 @@ +def __bootstrap__(): + global __bootstrap__, __loader__, __file__ + import sys, pkg_resources, imp + __file__ = pkg_resources.resource_filename(__name__,'error.so') + __loader__ = None; del __bootstrap__, __loader__ + imp.load_dynamic(__name__,__file__) +__bootstrap__() diff --git a/external_libs/python/zmq/backend/cython/libzmq.pxd b/external_libs/python/zmq/backend/cython/libzmq.pxd new file mode 100644 index 00000000..e42f6d6b --- /dev/null +++ b/external_libs/python/zmq/backend/cython/libzmq.pxd @@ -0,0 +1,110 @@ +"""All the C imports for 0MQ""" + +# +# Copyright (c) 2010 Brian E. Granger & Min Ragan-Kelley +# +# This file is part of pyzmq. +# +# pyzmq is free software; you can redistribute it and/or modify it under +# the terms of the Lesser GNU General Public License as published by +# the Free Software Foundation; either version 3 of the License, or +# (at your option) any later version. +# +# pyzmq is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# Lesser GNU General Public License for more details. +# +# You should have received a copy of the Lesser GNU General Public License +# along with this program. If not, see . +# + +#----------------------------------------------------------------------------- +# Imports +#----------------------------------------------------------------------------- + +#----------------------------------------------------------------------------- +# Import the C header files +#----------------------------------------------------------------------------- + +cdef extern from *: + ctypedef void* const_void_ptr "const void *" + ctypedef char* const_char_ptr "const char *" + +cdef extern from "zmq_compat.h": + ctypedef signed long long int64_t "pyzmq_int64_t" + +include "constant_enums.pxi" + +cdef extern from "zmq.h" nogil: + + void _zmq_version "zmq_version"(int *major, int *minor, int *patch) + + ctypedef int fd_t "ZMQ_FD_T" + + enum: errno + char *zmq_strerror (int errnum) + int zmq_errno() + + void *zmq_ctx_new () + int zmq_ctx_destroy (void *context) + int zmq_ctx_set (void *context, int option, int optval) + int zmq_ctx_get (void *context, int option) + void *zmq_init (int io_threads) + int zmq_term (void *context) + + # blackbox def for zmq_msg_t + ctypedef void * zmq_msg_t "zmq_msg_t" + + ctypedef void zmq_free_fn(void *data, void *hint) + + int zmq_msg_init (zmq_msg_t *msg) + int zmq_msg_init_size (zmq_msg_t *msg, size_t size) + int zmq_msg_init_data (zmq_msg_t *msg, void *data, + size_t size, zmq_free_fn *ffn, void *hint) + int zmq_msg_send (zmq_msg_t *msg, void *s, int flags) + int zmq_msg_recv (zmq_msg_t *msg, void *s, int flags) + int zmq_msg_close (zmq_msg_t *msg) + int zmq_msg_move (zmq_msg_t *dest, zmq_msg_t *src) + int zmq_msg_copy (zmq_msg_t *dest, zmq_msg_t *src) + void *zmq_msg_data (zmq_msg_t *msg) + size_t zmq_msg_size (zmq_msg_t *msg) + int zmq_msg_more (zmq_msg_t *msg) + int zmq_msg_get (zmq_msg_t *msg, int option) + int zmq_msg_set (zmq_msg_t *msg, int option, int optval) + const_char_ptr zmq_msg_gets (zmq_msg_t *msg, const_char_ptr property) + int zmq_has (const_char_ptr capability) + + void *zmq_socket (void *context, int type) + int zmq_close (void *s) + int zmq_setsockopt (void *s, int option, void *optval, size_t optvallen) + int zmq_getsockopt (void *s, int option, void *optval, size_t *optvallen) + int zmq_bind (void *s, char *addr) + int zmq_connect (void *s, char *addr) + int zmq_unbind (void *s, char *addr) + int zmq_disconnect (void *s, char *addr) + + int zmq_socket_monitor (void *s, char *addr, int flags) + + # send/recv + int zmq_sendbuf (void *s, const_void_ptr buf, size_t n, int flags) + int zmq_recvbuf (void *s, void *buf, size_t n, int flags) + + ctypedef struct zmq_pollitem_t: + void *socket + int fd + short events + short revents + + int zmq_poll (zmq_pollitem_t *items, int nitems, long timeout) + + int zmq_device (int device_, void *insocket_, void *outsocket_) + int zmq_proxy (void *frontend, void *backend, void *capture) + +cdef extern from "zmq_utils.h" nogil: + + void *zmq_stopwatch_start () + unsigned long zmq_stopwatch_stop (void *watch_) + void zmq_sleep (int seconds_) + int zmq_curve_keypair (char *z85_public_key, char *z85_secret_key) + diff --git a/external_libs/python/zmq/backend/cython/message.pxd b/external_libs/python/zmq/backend/cython/message.pxd new file mode 100644 index 00000000..4781195f --- /dev/null +++ b/external_libs/python/zmq/backend/cython/message.pxd @@ -0,0 +1,63 @@ +"""0MQ Message related class declarations.""" + +# +# Copyright (c) 2010-2011 Brian E. Granger & Min Ragan-Kelley +# +# This file is part of pyzmq. +# +# pyzmq is free software; you can redistribute it and/or modify it under +# the terms of the Lesser GNU General Public License as published by +# the Free Software Foundation; either version 3 of the License, or +# (at your option) any later version. +# +# pyzmq is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# Lesser GNU General Public License for more details. +# +# You should have received a copy of the Lesser GNU General Public License +# along with this program. If not, see . +# + +#----------------------------------------------------------------------------- +# Imports +#----------------------------------------------------------------------------- + +from cpython cimport PyBytes_FromStringAndSize + +from libzmq cimport zmq_msg_t, zmq_msg_data, zmq_msg_size + +#----------------------------------------------------------------------------- +# Code +#----------------------------------------------------------------------------- + +cdef class MessageTracker(object): + + cdef set events # Message Event objects to track. + cdef set peers # Other Message or MessageTracker objects. + + +cdef class Frame: + + cdef zmq_msg_t zmq_msg + cdef object _data # The actual message data as a Python object. + cdef object _buffer # A Python Buffer/View of the message contents + cdef object _bytes # A bytes/str copy of the message. + cdef bint _failed_init # Flag to handle failed zmq_msg_init + cdef public object tracker_event # Event for use with zmq_free_fn. + cdef public object tracker # MessageTracker object. + cdef public bint more # whether RCVMORE was set + + cdef Frame fast_copy(self) # Create shallow copy of Message object. + cdef object _getbuffer(self) # Construct self._buffer. + + +cdef inline object copy_zmq_msg_bytes(zmq_msg_t *zmq_msg): + """ Copy the data from a zmq_msg_t """ + cdef char *data_c = NULL + cdef Py_ssize_t data_len_c + data_c = zmq_msg_data(zmq_msg) + data_len_c = zmq_msg_size(zmq_msg) + return PyBytes_FromStringAndSize(data_c, data_len_c) + + diff --git a/external_libs/python/zmq/backend/cython/message.py b/external_libs/python/zmq/backend/cython/message.py new file mode 100644 index 00000000..5e423b62 --- /dev/null +++ b/external_libs/python/zmq/backend/cython/message.py @@ -0,0 +1,7 @@ +def __bootstrap__(): + global __bootstrap__, __loader__, __file__ + import sys, pkg_resources, imp + __file__ = pkg_resources.resource_filename(__name__,'message.so') + __loader__ = None; del __bootstrap__, __loader__ + imp.load_dynamic(__name__,__file__) +__bootstrap__() diff --git a/external_libs/python/zmq/backend/cython/socket.pxd b/external_libs/python/zmq/backend/cython/socket.pxd new file mode 100644 index 00000000..b8a331e2 --- /dev/null +++ b/external_libs/python/zmq/backend/cython/socket.pxd @@ -0,0 +1,47 @@ +"""0MQ Socket class declaration.""" + +# +# Copyright (c) 2010-2011 Brian E. Granger & Min Ragan-Kelley +# +# This file is part of pyzmq. +# +# pyzmq is free software; you can redistribute it and/or modify it under +# the terms of the Lesser GNU General Public License as published by +# the Free Software Foundation; either version 3 of the License, or +# (at your option) any later version. +# +# pyzmq is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# Lesser GNU General Public License for more details. +# +# You should have received a copy of the Lesser GNU General Public License +# along with this program. If not, see . +# + +#----------------------------------------------------------------------------- +# Imports +#----------------------------------------------------------------------------- + +from context cimport Context + +#----------------------------------------------------------------------------- +# Code +#----------------------------------------------------------------------------- + + +cdef class Socket: + + cdef object __weakref__ # enable weakref + cdef void *handle # The C handle for the underlying zmq object. + cdef bint _shadow # whether the Socket is a shadow wrapper of another + # Hold on to a reference to the context to make sure it is not garbage + # collected until the socket it done with it. + cdef public Context context # The zmq Context object that owns this. + cdef public bint _closed # bool property for a closed socket. + cdef int _pid # the pid of the process which created me (for fork safety) + + # cpdef methods for direct-cython access: + cpdef object send(self, object data, int flags=*, copy=*, track=*) + cpdef object recv(self, int flags=*, copy=*, track=*) + diff --git a/external_libs/python/zmq/backend/cython/socket.py b/external_libs/python/zmq/backend/cython/socket.py new file mode 100644 index 00000000..faef8bee --- /dev/null +++ b/external_libs/python/zmq/backend/cython/socket.py @@ -0,0 +1,7 @@ +def __bootstrap__(): + global __bootstrap__, __loader__, __file__ + import sys, pkg_resources, imp + __file__ = pkg_resources.resource_filename(__name__,'socket.so') + __loader__ = None; del __bootstrap__, __loader__ + imp.load_dynamic(__name__,__file__) +__bootstrap__() diff --git a/external_libs/python/zmq/backend/cython/utils.pxd b/external_libs/python/zmq/backend/cython/utils.pxd new file mode 100644 index 00000000..1d7117f1 --- /dev/null +++ b/external_libs/python/zmq/backend/cython/utils.pxd @@ -0,0 +1,29 @@ +"""Wrap zmq_utils.h""" + +# +# Copyright (c) 2010 Brian E. Granger & Min Ragan-Kelley +# +# This file is part of pyzmq. +# +# pyzmq is free software; you can redistribute it and/or modify it under +# the terms of the Lesser GNU General Public License as published by +# the Free Software Foundation; either version 3 of the License, or +# (at your option) any later version. +# +# pyzmq is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# Lesser GNU General Public License for more details. +# +# You should have received a copy of the Lesser GNU General Public License +# along with this program. If not, see . +# + +#----------------------------------------------------------------------------- +# Code +#----------------------------------------------------------------------------- + + +cdef class Stopwatch: + cdef void *watch # The C handle for the underlying zmq object + diff --git a/external_libs/python/zmq/backend/cython/utils.py b/external_libs/python/zmq/backend/cython/utils.py new file mode 100644 index 00000000..fe928300 --- /dev/null +++ b/external_libs/python/zmq/backend/cython/utils.py @@ -0,0 +1,7 @@ +def __bootstrap__(): + global __bootstrap__, __loader__, __file__ + import sys, pkg_resources, imp + __file__ = pkg_resources.resource_filename(__name__,'utils.so') + __loader__ = None; del __bootstrap__, __loader__ + imp.load_dynamic(__name__,__file__) +__bootstrap__() -- cgit From 36c6c87fe4380b214f8ff8a45dc0213fa109821c Mon Sep 17 00:00:00 2001 From: imarom Date: Mon, 24 Aug 2015 17:52:52 +0300 Subject: fix compile issues with external libarries --- external_libs/python/zmq/backend/cython/_device.so | Bin 0 -> 116272 bytes external_libs/python/zmq/backend/cython/_poll.so | Bin 0 -> 164229 bytes external_libs/python/zmq/backend/cython/_version.so | Bin 0 -> 45734 bytes external_libs/python/zmq/backend/cython/constants.so | Bin 0 -> 189238 bytes external_libs/python/zmq/backend/cython/context.so | Bin 0 -> 172716 bytes external_libs/python/zmq/backend/cython/error.so | Bin 0 -> 63000 bytes external_libs/python/zmq/backend/cython/message.so | Bin 0 -> 256078 bytes external_libs/python/zmq/backend/cython/socket.so | Bin 0 -> 472585 bytes external_libs/python/zmq/backend/cython/utils.so | Bin 0 -> 106936 bytes 9 files changed, 0 insertions(+), 0 deletions(-) create mode 100644 external_libs/python/zmq/backend/cython/_device.so create mode 100644 external_libs/python/zmq/backend/cython/_poll.so create mode 100644 external_libs/python/zmq/backend/cython/_version.so create mode 100644 external_libs/python/zmq/backend/cython/constants.so create mode 100644 external_libs/python/zmq/backend/cython/context.so create mode 100644 external_libs/python/zmq/backend/cython/error.so create mode 100644 external_libs/python/zmq/backend/cython/message.so create mode 100644 external_libs/python/zmq/backend/cython/socket.so create mode 100644 external_libs/python/zmq/backend/cython/utils.so (limited to 'external_libs/python/zmq/backend/cython') diff --git a/external_libs/python/zmq/backend/cython/_device.so b/external_libs/python/zmq/backend/cython/_device.so new file mode 100644 index 00000000..5957f8e0 Binary files /dev/null and b/external_libs/python/zmq/backend/cython/_device.so differ diff --git a/external_libs/python/zmq/backend/cython/_poll.so b/external_libs/python/zmq/backend/cython/_poll.so new file mode 100644 index 00000000..d93d0f10 Binary files /dev/null and b/external_libs/python/zmq/backend/cython/_poll.so differ diff --git a/external_libs/python/zmq/backend/cython/_version.so b/external_libs/python/zmq/backend/cython/_version.so new file mode 100644 index 00000000..40dd3dc8 Binary files /dev/null and b/external_libs/python/zmq/backend/cython/_version.so differ diff --git a/external_libs/python/zmq/backend/cython/constants.so b/external_libs/python/zmq/backend/cython/constants.so new file mode 100644 index 00000000..cf44c07e Binary files /dev/null and b/external_libs/python/zmq/backend/cython/constants.so differ diff --git a/external_libs/python/zmq/backend/cython/context.so b/external_libs/python/zmq/backend/cython/context.so new file mode 100644 index 00000000..ef9b9699 Binary files /dev/null and b/external_libs/python/zmq/backend/cython/context.so differ diff --git a/external_libs/python/zmq/backend/cython/error.so b/external_libs/python/zmq/backend/cython/error.so new file mode 100644 index 00000000..360da9dd Binary files /dev/null and b/external_libs/python/zmq/backend/cython/error.so differ diff --git a/external_libs/python/zmq/backend/cython/message.so b/external_libs/python/zmq/backend/cython/message.so new file mode 100644 index 00000000..f674489f Binary files /dev/null and b/external_libs/python/zmq/backend/cython/message.so differ diff --git a/external_libs/python/zmq/backend/cython/socket.so b/external_libs/python/zmq/backend/cython/socket.so new file mode 100644 index 00000000..1c927042 Binary files /dev/null and b/external_libs/python/zmq/backend/cython/socket.so differ diff --git a/external_libs/python/zmq/backend/cython/utils.so b/external_libs/python/zmq/backend/cython/utils.so new file mode 100644 index 00000000..b4e5b283 Binary files /dev/null and b/external_libs/python/zmq/backend/cython/utils.so differ -- cgit