1. markotibold
  2. pyzmq-static


Brandon Rhodes  committed 56e56b2

Broke 0MQ out into a standalone shared object that can be imported specially.

  • Participants
  • Parent commits 6cb76cb
  • Branches default

Comments (0)

Files changed (3)

File get.sh

View file
 #define HAVE_STDLIB_H\
 #define HAVE_SYS_FILE_H/' src_uuid/gen_uuid.c
+# Patch pyzmq to load an extra library.
+sed -i '/import initthreads/s/^/import ctypes\
+import os\
+p = os.path.join(os.path.dirname(__file__), "_zeromq.so")\
+_zeromq = ctypes.CDLL(p, mode=ctypes.RTLD_GLOBAL)\
+del ctypes, os, p\
+/' zmq/__init__.py
 # Generate platform.hpp from platform.hpp.in so that I can compare it
 # against the cached versions.

File setup.py

View file
 for submod, packages in submodules.items():
     for pkg in sorted(packages):
         sources = [pjoin('zmq', submod, pkg+'.c')]
-        sources.extend(static_sources)
         ext = Extension(
             'zmq.%s.%s'%(submod, pkg),
             sources = sources,
+                            sources=static_sources,
+                            include_dirs=include_dirs))
 package_data = {'zmq':['*.pxd'],

File zmq/__init__.py

View file
 # Imports
+import ctypes
+import os
+p = os.path.join(os.path.dirname(__file__), "_zeromq.so")
+_zeromq = ctypes.CDLL(p, mode=ctypes.RTLD_GLOBAL)
+del ctypes, os, p
 from zmq.utils import initthreads # initialize threads