Commits

Brandon Rhodes committed 56e56b2

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

Comments (0)

Files changed (3)

 #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.
 
 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,
         )
         extensions.append(ext)
 
+extensions.append(Extension('zmq._zeromq',
+                            sources=static_sources,
+                            include_dirs=include_dirs))
+
 package_data = {'zmq':['*.pxd'],
                 'zmq.core':['*.pxd'],
                 'zmq.devices':['*.pxd'],
 # 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
 initthreads.init_threads()