def run(self): # fetch sources for libzmq extension: bundledir = "bundled" if not os.path.exists(bundledir): os.makedirs(bundledir) fetch_uuid(bundledir) fetch_libzmq(bundledir) for tarball in glob(pjoin(bundledir, '*.tar.gz')): os.remove(tarball)
def bundle_libzmq_extension(self): bundledir = "bundled" if self.distribution.ext_modules[0].name == 'zmq.libzmq': # I've already been run return line() print ("Using bundled libzmq") # fetch sources for libzmq extension: if not os.path.exists(bundledir): os.makedirs(bundledir) if not sys.platform.startswith(('darwin', 'freebsd', 'win')): fetch_uuid(bundledir) fetch_libzmq(bundledir) stage_platform_hpp(pjoin(bundledir, 'zeromq')) # construct the Extension: ext = Extension( 'zmq.libzmq', sources = [pjoin('buildutils', 'initlibzmq.c')] + glob(pjoin(bundledir, 'zeromq', 'src', '*.cpp')), include_dirs = [ pjoin(bundledir, 'zeromq', 'include'), ], ) if sys.platform.startswith('win'): # include defines from zeromq msvc project: ext.define_macros.append(('FD_SETSIZE', 1024)) # When compiling the C++ code inside of libzmq itself, we want to # avoid "warning C4530: C++ exception handler used, but unwind # semantics are not enabled. Specify /EHsc". ext.extra_compile_args.append('/EHsc') # And things like sockets come from libraries that must be named. ext.libraries.append('rpcrt4') ext.libraries.append('ws2_32') elif not sys.platform.startswith(('darwin', 'freebsd')): # add uuid as both `uuid/uuid.h` and `uuid.h`: ext.include_dirs.append(pjoin(bundledir, 'uuid')) ext.include_dirs.append(bundledir) ext.sources.extend(glob(pjoin(bundledir, 'uuid', '*.c'))) ext.libraries.append('rt') # insert the extension: self.distribution.ext_modules.insert(0, ext) # update other extensions, with bundled settings settings = init_settings("bundled") for ext in self.distribution.ext_modules[1:]: for attr, value in settings.items(): setattr(ext, attr, value) save_config("buildconf", dict(zmq="bundled")) return dict(vers=bundled_version, settings=settings)
def bundle_libzmq_extension(self): bundledir = "bundled" if self.distribution.ext_modules[0].name == 'zmq.libzmq': # I've already been run return line() print ("Using bundled libzmq") # fetch sources for libzmq extension: if not os.path.exists(bundledir): os.makedirs(bundledir) if not sys.platform.startswith(('darwin', 'freebsd', 'win')): fetch_uuid(bundledir) fetch_libzmq(bundledir) stage_platform_hpp(pjoin(bundledir, 'zeromq')) # construct the Extension: ext = Extension( 'zmq.libzmq', sources = [pjoin('buildutils', 'initlibzmq.c')] + glob(pjoin(bundledir, 'zeromq', 'src', '*.cpp')), include_dirs = [ pjoin(bundledir, 'zeromq', 'include'), ], ) if sys.platform.startswith('win'): # include defines from zeromq msvc project: ext.define_macros.append(('FD_SETSIZE', 1024)) # When compiling the C++ code inside of libzmq itself, we want to # avoid "warning C4530: C++ exception handler used, but unwind # semantics are not enabled. Specify /EHsc". if self.compiler_type == 'msvc': ext.extra_compile_args.append('/EHsc') elif self.compiler_type == 'mingw32': ext.define_macros.append(('ZMQ_HAVE_MINGW32', 1)) # And things like sockets come from libraries that must be named. ext.libraries.append('rpcrt4') ext.libraries.append('ws2_32') elif not sys.platform.startswith(('darwin', 'freebsd')): # add uuid as both `uuid/uuid.h` and `uuid.h`: ext.include_dirs.append(pjoin(bundledir, 'uuid')) ext.include_dirs.append(bundledir) ext.sources.extend(glob(pjoin(bundledir, 'uuid', '*.c'))) ext.libraries.append('rt') # insert the extension: self.distribution.ext_modules.insert(0, ext) # update other extensions, with bundled settings settings = init_settings("bundled") for ext in self.distribution.ext_modules[1:]: for attr, value in settings.items(): setattr(ext, attr, value) save_config("buildconf", dict(zmq="bundled")) return dict(vers=bundled_version, settings=settings)