/usr/lib/python2.7/dist-packages/zmq/__init__.py is in python-zmq 16.0.2-2.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 | """Python bindings for 0MQ."""
# Copyright (C) PyZMQ Developers
# Distributed under the terms of the Modified BSD License.
# load bundled libzmq, if there is one:
def _load_libzmq():
"""load bundled libzmq if there is one"""
import sys, ctypes, platform
dlopen = hasattr(sys, 'getdlopenflags') # unix-only
if dlopen:
dlflags = sys.getdlopenflags()
sys.setdlopenflags(ctypes.RTLD_GLOBAL | dlflags)
try:
from . import libzmq
except ImportError:
pass
else:
# store libzmq as zmq._libzmq for backward-compat
globals()['_libzmq'] = libzmq
if platform.python_implementation().lower() == 'pypy':
# pypy needs explicit CDLL load for some reason,
# otherwise symbols won't be globally available
ctypes.CDLL(libzmq.__file__, ctypes.RTLD_GLOBAL)
finally:
if dlopen:
sys.setdlopenflags(dlflags)
_load_libzmq()
# zmq top-level imports
from zmq import backend
from zmq.backend import *
from zmq import sugar
from zmq.sugar import *
def get_includes():
"""Return a list of directories to include for linking against pyzmq with cython."""
from os.path import join, dirname, abspath, pardir, exists
base = dirname(__file__)
parent = abspath(join(base, pardir))
includes = [ parent ] + [ join(parent, base, subdir) for subdir in ('utils',) ]
if exists(join(parent, base, 'include')):
includes.append(join(parent, base, 'include'))
return includes
def get_library_dirs():
"""Return a list of directories used to link against pyzmq's bundled libzmq."""
from os.path import join, dirname, abspath, pardir
base = dirname(__file__)
parent = abspath(join(base, pardir))
return [ join(parent, base) ]
__all__ = ['get_includes'] + sugar.__all__ + backend.__all__
|