def check_zmq_version(self): """check the zmq version""" cfg = self.config # build test program zmq_prefix = cfg['zmq_prefix'] detected = self.test_build(zmq_prefix, self.compiler_settings) # now check the libzmq version vers = tuple(detected['vers']) vs = v_str(vers) if cfg['allow_legacy_libzmq']: min_zmq = min_legacy_zmq else: min_zmq = min_good_zmq if vers < min_zmq: msg = [ "Detected ZMQ version: %s, but require ZMQ >= %s" % (vs, v_str(min_zmq)), ] if zmq_prefix: msg.append(" ZMQ_PREFIX=%s" % zmq_prefix) if vers >= min_legacy_zmq: msg.append( " Explicitly allow legacy zmq by specifying `--zmq=/zmq/prefix`" ) raise LibZMQVersionError('\n'.join(msg)) if vers < min_good_zmq: msg = [ "Detected legacy ZMQ version: %s. It is STRONGLY recommended to use ZMQ >= %s" % (vs, v_str(min_good_zmq)), ] if zmq_prefix: msg.append(" ZMQ_PREFIX=%s" % zmq_prefix) warn('\n'.join(msg)) elif vers < target_zmq: warn("Detected ZMQ version: %s, but pyzmq targets ZMQ %s." % (vs, v_str(target_zmq))) warn( "libzmq features and fixes introduced after %s will be unavailable." % vs) line() elif vers >= dev_zmq: warn( "Detected ZMQ version: %s. Some new features in libzmq may not be exposed by pyzmq." % vs) line() if sys.platform.startswith('win'): # fetch libzmq.dll into local dir local_dll = localpath('zmq', libzmq_name + '.dll') if not zmq_prefix and not os.path.exists(local_dll): fatal( "ZMQ directory must be specified on Windows via setup.cfg or 'python setup.py configure --zmq=/path/to/libzmq'" )
def check_zmq_version(self): """check the zmq version""" cfg = self.config # build test program zmq_prefix = cfg["zmq_prefix"] detected = self.test_build(zmq_prefix, self.compiler_settings) # now check the libzmq version vers = tuple(detected["vers"]) vs = v_str(vers) if cfg["allow_legacy_libzmq"]: min_zmq = min_legacy_zmq else: min_zmq = min_good_zmq if vers < min_zmq: msg = ["Detected ZMQ version: %s, but require ZMQ >= %s" % (vs, v_str(min_zmq))] if zmq_prefix: msg.append(" ZMQ_PREFIX=%s" % zmq_prefix) if vers >= min_legacy_zmq: msg.append(" Explicitly allow legacy zmq by specifying `--zmq=/zmq/prefix`") raise LibZMQVersionError("\n".join(msg)) if vers < min_good_zmq: msg = [ "Detected legacy ZMQ version: %s. It is STRONGLY recommended to use ZMQ >= %s" % (vs, v_str(min_good_zmq)) ] if zmq_prefix: msg.append(" ZMQ_PREFIX=%s" % zmq_prefix) warn("\n".join(msg)) elif vers < target_zmq: warn("Detected ZMQ version: %s, but pyzmq targets ZMQ %s." % (vs, v_str(target_zmq))) warn("libzmq features and fixes introduced after %s will be unavailable." % vs) line() elif vers >= dev_zmq: warn("Detected ZMQ version: %s. Some new features in libzmq may not be exposed by pyzmq." % vs) line() if sys.platform.startswith("win"): # fetch libzmq.dll into local dir local_dll = localpath("zmq", "libzmq.dll") if not zmq_prefix and not os.path.exists(local_dll): fatal( "ZMQ directory must be specified on Windows via setup.cfg or 'python setup.py configure --zmq=/path/to/zeromq2'" ) try: shutil.copy(pjoin(zmq_prefix, "lib", "libzmq.dll"), local_dll) except Exception: if not os.path.exists(local_dll): warn( "Could not copy libzmq into zmq/, which is usually necessary on Windows." "Please specify zmq prefix via configure --zmq=/path/to/zmq or copy " "libzmq into zmq/ manually." )
def check_zmq_version(self): zmq = self.zmq if zmq is not None and zmq is not "bundled" and not os.path.isdir(zmq): fatal("Custom zmq directory \"%s\" does not exist" % zmq) config = self.getcached() if not config or config.get('settings') != self.settings: self.run() config = self.config else: self.config = config line() if self.zmq == "bundled": return vers = config['vers'] vs = v_str(vers) if vers < min_zmq: fatal("Detected ZMQ version: %s, but depend on zmq >= %s" % (vs, v_str(min_zmq)) + '\n Using ZMQ=%s' % (zmq or 'unspecified')) pyzmq_version = extract_version().strip('abcdefghijklmnopqrstuvwxyz') if vs < pyzmq_version: warn("Detected ZMQ version: %s, but pyzmq targets zmq %s." % (vs, pyzmq_version)) warn( "libzmq features and fixes introduced after %s will be unavailable." % vs) line() elif vs >= '3.0': warn( "Detected ZMQ version: %s. pyzmq's support for libzmq-dev is experimental." % vs) line() if sys.platform.startswith('win'): # fetch libzmq.dll into local dir local_dll = localpath('zmq', 'libzmq.dll') if zmq is None and not os.path.exists(local_dll): fatal( "ZMQ directory must be specified on Windows via setup.cfg or 'python setup.py configure --zmq=/path/to/zeromq2'" ) try: shutil.copy(pjoin(zmq, 'lib', 'libzmq.dll'), local_dll) except Exception: if not os.path.exists(local_dll): warn( "Could not copy libzmq into zmq/, which is usually necessary on Windows." "Please specify zmq prefix via configure --zmq=/path/to/zmq or copy " "libzmq into zmq/ manually.")
def check_zmq_version(self): zmq = CONFIG['zmq_prefix'] if zmq and not os.path.exists(zmq) and \ not CONFIG['libzmq_extension']: fatal("Custom zmq directory \"%s\" does not exist" % zmq) config = self.getcached() if not config or config.get('settings') != self.settings: self.run() config = self.config else: if CONFIG['libzmq_extension']: config = self.bundle_libzmq_extension() self.config = config line() if CONFIG['libzmq_extension'] or CONFIG['skip_check_zmq'] or CROSSCOMPILE: return # now check the libzmq version vers = tuple(config['vers']) vs = v_str(vers) if vers < min_zmq: fatal("Detected ZMQ version: %s, but depend on zmq >= %s"%( vs, v_str(min_zmq)) +'\n Using ZMQ=%s'%(zmq or 'unspecified')) if vers < target_zmq: warn("Detected ZMQ version: %s, but pyzmq targets ZMQ %s." % ( vs, v_str(target_zmq)) ) warn("libzmq features and fixes introduced after %s will be unavailable." % vs) line() elif vers >= dev_zmq: warn("Detected ZMQ version: %s. pyzmq's support for libzmq-dev is experimental." % vs) line() if sys.platform.startswith('win'): # fetch libzmq.dll into local dir local_dll = localpath('zmq','libzmq.dll') if not zmq and not os.path.exists(local_dll): fatal("ZMQ directory must be specified on Windows via setup.cfg or 'python setup.py configure --zmq=/path/to/zeromq2'") try: shutil.copy(pjoin(zmq, 'lib', 'libzmq.dll'), local_dll) except Exception: if not os.path.exists(local_dll): warn("Could not copy libzmq into zmq/, which is usually necessary on Windows." "Please specify zmq prefix via configure --zmq=/path/to/zmq or copy " "libzmq into zmq/ manually.")
def run(self): self.create_tempdir() settings = copy.copy(COMPILER_SETTINGS) if doing_bdist and not sys.platform.startswith('win'): # rpath slightly differently here, because libzmq not in .. but ../zmq: settings['library_dirs'] = ['zmq'] if sys.platform == 'darwin': pass # unused rpath args for OSX: # settings['extra_link_args'] = ['-Wl,-rpath','-Wl,$ORIGIN/../zmq'] else: settings['runtime_library_dirs'] = ['$ORIGIN/../zmq'] try: print ("*"*42) print ("Configure: Autodetecting ZMQ settings...") print (" Custom ZMQ dir: %s" % (ZMQ,)) config = detect_zmq(self.tempdir, **settings) except Exception: fatal(""" Failed to compile ZMQ test program. Please check to make sure: * You have a C compiler installed * A development version of Python is installed (including header files) * A development version of ZeroMQ >= 2.1.0 is installed (including header files) * If ZMQ is not in a default location, supply the argument --zmq=<path>""") else: savepickle('configure.pickle', config) print (" ZMQ version detected: %s" % v_str(config['vers'])) finally: print ("*"*42) self.erase_tempdir() self.config = config
def test_build(self, prefix, settings): """do a test build ob libzmq""" self.create_tempdir() settings = settings.copy() if self.bundle_libzmq_dylib and not sys.platform.startswith('win'): # rpath slightly differently here, because libzmq not in .. but ../zmq: settings['library_dirs'] = ['zmq'] if sys.platform == 'darwin': pass # unused rpath args for OS X: # settings['extra_link_args'] = ['-Wl,-rpath','-Wl,$ORIGIN/../zmq'] else: settings['runtime_library_dirs'] = [ os.path.abspath(pjoin('.', 'zmq')) ] line() info("Configure: Autodetecting ZMQ settings...") info(" Custom ZMQ dir: %s" % prefix) try: detected = detect_zmq(self.tempdir, compiler=self.compiler_type, **settings) finally: self.erase_tempdir() info(" ZMQ version detected: %s" % v_str(detected['vers'])) return detected
def run(self): self.create_tempdir() settings = copy.copy(COMPILER_SETTINGS) if doing_bdist and not sys.platform.startswith('win'): # rpath slightly differently here, because libzmq not in .. but ../zmq: settings['library_dirs'] = ['zmq'] if sys.platform == 'darwin': pass # unused rpath args for OSX: # settings['extra_link_args'] = ['-Wl,-rpath','-Wl,$ORIGIN/../zmq'] else: settings['runtime_library_dirs'] = ['$ORIGIN/../zmq'] try: print("*" * 42) print("Configure: Autodetecting ZMQ settings...") print(" Custom ZMQ dir: %s" % (ZMQ, )) config = detect_zmq(self.tempdir, **settings) except Exception: etype, evalue, tb = sys.exc_info() # print the error as distutils would if we let it raise: print("error: %s" % evalue) if etype is CompileError: action = 'compile' elif etype is LinkError: action = 'link' else: action = 'build or run' fatal(""" Failed to %s ZMQ test program. Please check to make sure: * You have a C compiler installed * A development version of Python is installed (including header files) * A development version of ZMQ >= %s is installed (including header files) * If ZMQ is not in a default location, supply the argument --zmq=<path> * If you did recently install ZMQ to a default location, try rebuilding the ld cache with `sudo ldconfig` or specify zmq's location with `--zmq=/usr/local` """ % (action, v_str(min_zmq))) else: savepickle('configure.pickle', config) print(" ZMQ version detected: %s" % v_str(config['vers'])) finally: print("*" * 42) self.erase_tempdir() self.config = config
def check_zmq_version(self): zmq = self.zmq if zmq is not None and zmq is not "bundled" and not os.path.isdir(zmq): fatal("Custom zmq directory \"%s\" does not exist" % zmq) config = self.getcached() if not config or config.get('settings') != self.settings: self.run() config = self.config else: self.config = config line() if self.zmq == "bundled": return vers = tuple(config['vers']) vs = v_str(vers) if vers < min_zmq: fatal("Detected ZMQ version: %s, but depend on zmq >= %s"%( vs, v_str(min_zmq)) +'\n Using ZMQ=%s'%(zmq or 'unspecified')) pyzmq_vs = extract_version() pyzmq_version = tuple(int(d) for d in re.findall(r'\d+', pyzmq_vs)) if vers < pyzmq_version[:len(vers)]: warn("Detected ZMQ version: %s, but pyzmq targets zmq %s."%( vs, pyzmq_version)) warn("libzmq features and fixes introduced after %s will be unavailable."%vs) line() elif vers >= (3,0,0): warn("Detected ZMQ version: %s. pyzmq's support for libzmq-dev is experimental."%vs) line() if sys.platform.startswith('win'): # fetch libzmq.dll into local dir local_dll = localpath('zmq','libzmq.dll') if zmq is None and not os.path.exists(local_dll): fatal("ZMQ directory must be specified on Windows via setup.cfg or 'python setup.py configure --zmq=/path/to/zeromq2'") try: shutil.copy(pjoin(zmq, 'lib', 'libzmq.dll'), local_dll) except Exception: if not os.path.exists(local_dll): warn("Could not copy libzmq into zmq/, which is usually necessary on Windows." "Please specify zmq prefix via configure --zmq=/path/to/zmq or copy " "libzmq into zmq/ manually.")
def check_zmq_version(self): zmq = ZMQ if zmq is not None and not os.path.isdir(zmq): fatal('Custom zmq directory "%s" does not exist' % zmq) config = self.getcached() if config is None or config["options"] != COMPILER_SETTINGS: self.run() config = self.config else: self.config = config vers = config["vers"] vs = v_str(vers) if vers < min_zmq: fatal( "Detected ZMQ version: %s, but depend on zmq >= %s" % (vs, v_str(min_zmq)) + "\n Using ZMQ=%s" % (zmq or "unspecified") ) pyzmq_version = extract_version().strip("abcdefghijklmnopqrstuvwxyz") if vs < pyzmq_version: warn("Detected ZMQ version: %s, but pyzmq targets zmq %s." % (vs, pyzmq_version)) warn("libzmq features and fixes introduced after %s will be unavailable." % vs) print("*" * 42) elif vs > "3.0": warn("Detected ZMQ version: %s. pyzmq's 3.0 support is experimental." % vs) print("*" * 42) if sys.platform.startswith("win"): # fetch libzmq.dll into local dir local_dll = localpath("zmq", "libzmq.dll") if zmq is None and not os.path.exists(local_dll): fatal( "ZMQ directory must be specified on Windows via setup.cfg or 'python setup.py configure --zmq=/path/to/zeromq2'" ) try: shutil.copy(pjoin(zmq, "lib", "libzmq.dll"), local_dll) except Exception: if not os.path.exists(local_dll): warn( "Could not copy libzmq into zmq/, which is usually necessary on Windows." "Please specify zmq prefix via configure --zmq=/path/to/zmq or copy " "libzmq into zmq/ manually." )
def check_zmq_version(self): """check the zmq version""" cfg = self.config # build test program zmq_prefix = self.config['zmq_prefix'] detected = self.test_build(zmq_prefix, self.compiler_settings) # now check the libzmq version vers = tuple(detected['vers']) vs = v_str(vers) if vers < min_zmq: fatal("Detected ZMQ version: %s, but depend on zmq >= %s" % (vs, v_str(min_zmq)) + '\n Using ZMQ=%s' % (zmq_prefix or 'unspecified')) if vers < target_zmq: warn("Detected ZMQ version: %s, but pyzmq targets ZMQ %s." % (vs, v_str(target_zmq))) warn( "libzmq features and fixes introduced after %s will be unavailable." % vs) line() elif vers >= dev_zmq: warn( "Detected ZMQ version: %s. pyzmq's support for libzmq-dev is experimental." % vs) line() if sys.platform.startswith('win'): # fetch libzmq.dll into local dir local_dll = localpath('zmq', 'libzmq.dll') if not zmq_prefix and not os.path.exists(local_dll): fatal( "ZMQ directory must be specified on Windows via setup.cfg or 'python setup.py configure --zmq=/path/to/zeromq2'" ) try: shutil.copy(pjoin(zmq_prefix, 'lib', 'libzmq.dll'), local_dll) except Exception: if not os.path.exists(local_dll): warn( "Could not copy libzmq into zmq/, which is usually necessary on Windows." "Please specify zmq prefix via configure --zmq=/path/to/zmq or copy " "libzmq into zmq/ manually.")
def run(self): self.create_tempdir() settings = copy.copy(COMPILER_SETTINGS) if doing_bdist and not sys.platform.startswith('win'): # rpath slightly differently here, because libzmq not in .. but ../zmq: settings['library_dirs'] = ['zmq'] if sys.platform == 'darwin': pass # unused rpath args for OSX: # settings['extra_link_args'] = ['-Wl,-rpath','-Wl,$ORIGIN/../zmq'] else: settings['runtime_library_dirs'] = ['$ORIGIN/../zmq'] try: print ("*"*42) print ("Configure: Autodetecting ZMQ settings...") print (" Custom ZMQ dir: %s" % (ZMQ,)) config = detect_zmq(self.tempdir, **settings) except Exception: etype = sys.exc_info()[0] if etype is CompileError: action = 'compile' elif etype is LinkError: action = 'link' else: action = 'run' fatal(""" Failed to %s ZMQ test program. Please check to make sure: * You have a C compiler installed * A development version of Python is installed (including header files) * A development version of ZMQ >= %s is installed (including header files) * If ZMQ is not in a default location, supply the argument --zmq=<path> * If you did recently install ZMQ to a default location, try rebuilding the ld cache with `sudo ldconfig` or specify zmq's location with `--zmq=/usr/local` """%(action, v_str(min_zmq))) else: savepickle('configure.pickle', config) print (" ZMQ version detected: %s" % v_str(config['vers'])) finally: print ("*"*42) self.erase_tempdir() self.config = config
def check_zmq_version(self): """check the zmq version""" cfg = self.config # build test program zmq_prefix = self.config["zmq_prefix"] detected = self.test_build(zmq_prefix, self.compiler_settings) # now check the libzmq version vers = tuple(detected["vers"]) vs = v_str(vers) if vers < min_zmq: fatal( "Detected ZMQ version: %s, but depend on zmq >= %s" % (vs, v_str(min_zmq)) + "\n Using ZMQ=%s" % (zmq_prefix or "unspecified") ) if vers < target_zmq: warn("Detected ZMQ version: %s, but pyzmq targets ZMQ %s." % (vs, v_str(target_zmq))) warn("libzmq features and fixes introduced after %s will be unavailable." % vs) line() elif vers >= dev_zmq: warn("Detected ZMQ version: %s. pyzmq's support for libzmq-dev is experimental." % vs) line() if sys.platform.startswith("win"): # fetch libzmq.dll into local dir local_dll = localpath("zmq", "libzmq.dll") if not zmq_prefix and not os.path.exists(local_dll): fatal( "ZMQ directory must be specified on Windows via setup.cfg or 'python setup.py configure --zmq=/path/to/zeromq2'" ) try: shutil.copy(pjoin(zmq_prefix, "lib", "libzmq.dll"), local_dll) except Exception: if not os.path.exists(local_dll): warn( "Could not copy libzmq into zmq/, which is usually necessary on Windows." "Please specify zmq prefix via configure --zmq=/path/to/zmq or copy " "libzmq into zmq/ manually." )
def check_zmq_version(self): zmq = self.zmq if zmq is not None and not os.path.isdir(zmq): fatal("Custom zmq directory \"%s\" does not exist" % zmq) config = self.getcached() if config is None or config['options'] != self.settings: self.run() config = self.config else: self.config = config vers = config['vers'] vs = v_str(vers) if vers < min_zmq: fatal("Detected ZMQ version: %s, but depend on zmq >= %s"%( vs, v_str(min_zmq)) +'\n Using ZMQ=%s'%(zmq or 'unspecified')) pyzmq_version = extract_version().strip('abcdefghijklmnopqrstuvwxyz') if vs < pyzmq_version: warn("Detected ZMQ version: %s, but pyzmq targets zmq %s."%( vs, pyzmq_version)) warn("libzmq features and fixes introduced after %s will be unavailable."%vs) print('*'*42) elif vs >= '3.0': warn("Detected ZMQ version: %s. pyzmq's support for libzmq-dev is experimental."%vs) print('*'*42) if sys.platform.startswith('win'): # fetch libzmq.dll into local dir local_dll = localpath('zmq','libzmq.dll') if zmq is None and not os.path.exists(local_dll): fatal("ZMQ directory must be specified on Windows via setup.cfg or 'python setup.py configure --zmq=/path/to/zeromq2'") try: shutil.copy(pjoin(zmq, 'lib', 'libzmq.dll'), local_dll) except Exception: if not os.path.exists(local_dll): warn("Could not copy libzmq into zmq/, which is usually necessary on Windows." "Please specify zmq prefix via configure --zmq=/path/to/zmq or copy " "libzmq into zmq/ manually.")
def check_zmq_version(self): zmq = ZMQ if zmq is not None and not os.path.isdir(zmq): fatal("Custom zmq directory \"%s\" does not exist" % zmq) config = self.getcached() if config is None or config['options'] != COMPILER_SETTINGS: self.run() config = self.config vers = config['vers'] vs = v_str(vers) if vers < min_zmq: fatal("Detected ZMQ version: %s, but depend on zmq >= %s" % (vs, v_str(min_zmq)) + '\n Using ZMQ=%s' % (zmq or 'unspecified')) pyzmq_version = extract_version().strip('abcdefghijklmnopqrstuvwxyz') if vs < pyzmq_version: warn("Detected ZMQ version: %s, but pyzmq is based on zmq %s." % (vs, pyzmq_version)) warn("Some features may be missing or broken.") print('*' * 42) if sys.platform.startswith('win'): # fetch libzmq.dll into local dir local_dll = localpath('zmq', 'libzmq.dll') if zmq is None and not os.path.exists(local_dll): fatal( "ZMQ directory must be specified on Windows via setup.cfg or 'python setup.py configure --zmq=/path/to/zeromq2'" ) try: shutil.copy(pjoin(zmq, 'lib', 'libzmq.dll'), local_dll) except Exception: if not os.path.exists(local_dll): warn( "Could not copy libzmq into zmq/, which is usually necessary on Windows." "Please specify zmq prefix via configure --zmq=/path/to/zmq or copy " "libzmq into zmq/ manually.")
def fallback_on_bundled(self): """Couldn't build, fallback after waiting a while""" line() warn('\n'.join([ "Failed to build or run libzmq detection test.", "", "If you expected pyzmq to link against an installed libzmq, please check to make sure:", "", " * You have a C compiler installed", " * A development version of Python is installed (including headers)", " * A development version of ZMQ >= %s is installed (including headers)" % v_str(min_zmq), " * If ZMQ is not in a default location, supply the argument --zmq=<path>", " * If you did recently install ZMQ to a default location,", " try rebuilding the ld cache with `sudo ldconfig`", " or specify zmq's location with `--zmq=/usr/local`", "", ])) # ultra-lazy pip detection: if 'pip' in ' '.join(sys.argv): info('\n'.join([ "If you expected to get a binary install (egg), we have those for", "current Pythons on OS X and Windows. These can be installed with", "easy_install, but PIP DOES NOT SUPPORT EGGS.", "", ])) info('\n'.join([ "You can skip all this detection/waiting nonsense if you know", "you want pyzmq to bundle libzmq as an extension by passing:", "", " `--zmq=bundled`", "", "I will now try to build libzmq as a Python extension", "unless you interrupt me (^C) in the next 10 seconds...", "", ])) for i in range(10, 0, -1): sys.stdout.write('\r%2i...' % i) sys.stdout.flush() time.sleep(1) info("") return self.bundle_libzmq_extension()
def check_zmq_version(self): zmq = ZMQ if zmq is not None and not os.path.isdir(zmq): fatal("Custom zmq directory \"%s\" does not exist" % zmq) config = self.getcached() if config is None or config['options'] != COMPILER_SETTINGS: self.run() config = self.config vers = config['vers'] vs = v_str(vers) if vers < min_zmq: fatal("Detected ZMQ version: %s, but depend on zmq >= %s"%( vs, v_str(min_zmq)) +'\n Using ZMQ=%s'%(zmq or 'unspecified')) pyzmq_version = extract_version().strip('abcdefghijklmnopqrstuvwxyz') if vs < pyzmq_version: warn("Detected ZMQ version: %s, but pyzmq is based on zmq %s."%( vs, pyzmq_version)) warn("Some features may be missing or broken.") print('*'*42) if sys.platform.startswith('win'): # fetch libzmq.dll into local dir local_dll = localpath('zmq','libzmq.dll') if zmq is None and not os.path.exists(local_dll): fatal("ZMQ directory must be specified on Windows via setup.cfg or 'python setup.py configure --zmq=/path/to/zeromq2'") try: shutil.copy(pjoin(zmq, 'lib', 'libzmq.dll'), local_dll) except Exception: if not os.path.exists(local_dll): warn("Could not copy libzmq into zmq/, which is usually necessary on Windows." "Please specify zmq prefix via configure --zmq=/path/to/zmq or copy " "libzmq into zmq/ manually.")
def test_build(self, prefix, settings): """do a test build ob libzmq""" self.create_tempdir() settings = settings.copy() line() info("Configure: Autodetecting ZMQ settings...") info(" Custom ZMQ dir: %s" % prefix) try: detected = detect_zmq(self.tempdir, compiler=self.compiler_type, **settings) finally: self.erase_tempdir() info(" ZMQ version detected: %s" % v_str(detected['vers'])) return detected
def test_build(self, prefix, settings): """do a test build ob libzmq""" self.create_tempdir() settings = settings.copy() if self.bundle_libzmq_dylib and not sys.platform.startswith('win'): # rpath slightly differently here, because libzmq not in .. but ../zmq: settings['library_dirs'] = ['zmq'] _add_rpath(settings, os.path.abspath(pjoin('.', 'zmq'))) line() info("Configure: Autodetecting ZMQ settings...") info(" Custom ZMQ dir: %s" % prefix) try: detected = detect_zmq(self.tempdir, compiler=self.compiler_type, **settings) finally: self.erase_tempdir() info(" ZMQ version detected: %s" % v_str(detected['vers'])) return detected
def fallback_on_bundled(self): """Couldn't build, fallback after waiting a while""" line() warn('\n'.join([ "Couldn't find an acceptable libzmq on the system.", "", "If you expected pyzmq to link against an installed libzmq, please check to make sure:", "", " * You have a C compiler installed", " * A development version of Python is installed (including headers)", " * A development version of ZMQ >= %s is installed (including headers)" % v_str(min_good_zmq), " * If ZMQ is not in a default location, supply the argument --zmq=<path>", " * If you did recently install ZMQ to a default location,", " try rebuilding the ld cache with `sudo ldconfig`", " or specify zmq's location with `--zmq=/usr/local`", "", ])) info('\n'.join([ "You can skip all this detection/waiting nonsense if you know", "you want pyzmq to bundle libzmq as an extension by passing:", "", " `--zmq=bundled`", "", "I will now try to build libzmq as a Python extension", "unless you interrupt me (^C) in the next 10 seconds...", "", ])) for i in range(10, 0, -1): sys.stdout.write('\r%2i...' % i) sys.stdout.flush() time.sleep(1) info("") return self.bundle_libzmq_extension()
def run(self): self.create_tempdir() try: print ("*"*42) print ("Configure: Autodetecting ZMQ settings...") print (" Custom ZMQ dir: %s" % (ZMQ,)) config = detect_zmq(self.tempdir, **COMPILER_SETTINGS) except Exception: logging.error(""" Failed to compile ZMQ test program. Please check to make sure: * You have a C compiler installed * A development version of Python is installed (including header files) * A development version of ZeroMQ >= 2.1.0 is installed (including header files) * If ZMQ is not in a default location, supply the argument --zmq=<path>""") raise else: savepickle('configure.pickle', config) print (" ZMQ version detected: %s" % v_str(config['vers'])) finally: print ("*"*42) self.erase_tempdir() self.config = config
def run(self): self.create_tempdir() try: print("*" * 42) print("Configure: Autodetecting ZMQ settings...") print(" Custom ZMQ dir: %s" % (ZMQ, )) config = detect_zmq(self.tempdir, **COMPILER_SETTINGS) except Exception: logging.error(""" Failed to compile ZMQ test program. Please check to make sure: * You have a C compiler installed * A development version of Python is installed (including header files) * A development version of ZeroMQ >= 2.1.0 is installed (including header files) * If ZMQ is not in a default location, supply the argument --zmq=<path>""") raise else: savepickle('configure.pickle', config) print(" ZMQ version detected: %s" % v_str(config['vers'])) finally: print("*" * 42) self.erase_tempdir() self.config = config
def test_build(self, zmq, settings): self.create_tempdir() if bundle_libzmq_dylib and not sys.platform.startswith('win'): # rpath slightly differently here, because libzmq not in .. but ../zmq: settings['library_dirs'] = ['zmq'] if sys.platform == 'darwin': pass # unused rpath args for OSX: # settings['extra_link_args'] = ['-Wl,-rpath','-Wl,$ORIGIN/../zmq'] else: settings['runtime_library_dirs'] = ['$ORIGIN/../zmq'] line() print ("Configure: Autodetecting ZMQ settings...") print (" Custom ZMQ dir: %s" % zmq) try: config = detect_zmq(self.tempdir, **settings) finally: self.erase_tempdir() print (" ZMQ version detected: %s" % v_str(config['vers'])) return config
def test_build(self, zmq, settings): self.create_tempdir() if bundle_libzmq_dylib and not sys.platform.startswith('win'): # rpath slightly differently here, because libzmq not in .. but ../zmq: settings['library_dirs'] = ['zmq'] if sys.platform == 'darwin': pass # unused rpath args for OSX: # settings['extra_link_args'] = ['-Wl,-rpath','-Wl,$ORIGIN/../zmq'] else: settings['runtime_library_dirs'] = ['$ORIGIN/../zmq'] line() print ("Configure: Autodetecting ZMQ settings...") print (" Custom ZMQ dir: %s" % zmq) try: config = detect_zmq(self.tempdir, compiler=self.compiler_type, **settings) finally: self.erase_tempdir() print (" ZMQ version detected: %s" % v_str(config['vers'])) return config
def fallback_on_bundled(self): """Couldn't build, fallback after waiting a while""" line() warn('\n'.join([ "Failed to build or run libzmq detection test.", "", "If you expected pyzmq to link against an installed libzmq, please check to make sure:", "", " * You have a C compiler installed", " * A development version of Python is installed (including headers)", " * A development version of ZMQ >= %s is installed (including headers)" % v_str(min_zmq), " * If ZMQ is not in a default location, supply the argument --zmq=<path>", " * If you did recently install ZMQ to a default location,", " try rebuilding the ld cache with `sudo ldconfig`", " or specify zmq's location with `--zmq=/usr/local`", "", ])) # ultra-lazy pip detection: if 'pip' in ' '.join(sys.argv): info('\n'.join([ "If you expected to get a binary install (egg), we have those for", "current Pythons on OS X and Windows. These can be installed with", "easy_install, but PIP DOES NOT SUPPORT EGGS.", "", ])) info('\n'.join([ "You can skip all this detection/waiting nonsense if you know", "you want pyzmq to bundle libzmq as an extension by passing:", "", " `--zmq=bundled`", "", "I will now try to build libzmq as a Python extension", "unless you interrupt me (^C) in the next 10 seconds...", "", ])) for i in range(10,0,-1): sys.stdout.write('\r%2i...' % i) sys.stdout.flush() time.sleep(1) info("") return self.bundle_libzmq_extension()
def run(self): self.create_tempdir() settings = self.settings if bundle_libzmq and not sys.platform.startswith('win'): # rpath slightly differently here, because libzmq not in .. but ../zmq: settings['library_dirs'] = ['zmq'] if sys.platform == 'darwin': pass # unused rpath args for OSX: # settings['extra_link_args'] = ['-Wl,-rpath','-Wl,$ORIGIN/../zmq'] else: settings['runtime_library_dirs'] = ['$ORIGIN/../zmq'] try: print ("*"*42) print ("Configure: Autodetecting ZMQ settings...") print (" Custom ZMQ dir: %s" % (self.zmq,)) config = detect_zmq(self.tempdir, **settings) except Exception: # if zmq unspecified on *ix, try again with explicit /usr/local if self.zmq is None and not sys.platform.startswith('win'): self.erase_tempdir() print ("Failed with default libzmq, trying again with /usr/local") self.zmq = '/usr/local' self.settings = settings_from_prefix(self.zmq) self.run() # if we get here the second run succeeded, so we need to update compiler # settings for the extensions with /usr/local prefix for ext in self.distribution.ext_modules: for key,value in self.settings.iteritems(): setattr(ext, key, value) return etype, evalue, tb = sys.exc_info() # print the error as distutils would if we let it raise: print ("error: %s" % evalue) if etype is CompileError: action = 'compile' elif etype is LinkError: action = 'link' else: action = 'build or run' fatal(""" Failed to %s ZMQ test program. Please check to make sure: * You have a C compiler installed * A development version of Python is installed (including header files) * A development version of ZMQ >= %s is installed (including header files) * If ZMQ is not in a default location, supply the argument --zmq=<path> * If you did recently install ZMQ to a default location, try rebuilding the ld cache with `sudo ldconfig` or specify zmq's location with `--zmq=/usr/local` """%(action, v_str(min_zmq))) else: savepickle('configure.pickle', config) print (" ZMQ version detected: %s" % v_str(config['vers'])) finally: print ("*"*42) self.erase_tempdir() self.config = config
def fallback_on_bundled(self): """Couldn't build, fallback after waiting a while""" line() warn('\n'.join([ "Couldn't find an acceptable libzmq on the system.", "", "If you expected pyzmq to link against an installed libzmq, please check to make sure:", "", " * You have a C compiler installed", " * A development version of Python is installed (including headers)", " * A development version of ZMQ >= %s is installed (including headers)" % v_str(min_good_zmq), " * If ZMQ is not in a default location, supply the argument --zmq=<path>", " * If you did recently install ZMQ to a default location,", " try rebuilding the ld cache with `sudo ldconfig`", " or specify zmq's location with `--zmq=/usr/local`", "", ])) info('\n'.join([ "You can skip all this detection/waiting nonsense if you know", "you want pyzmq to bundle libzmq as an extension by passing:", "", " `--zmq=bundled`", "", "I will now try to build libzmq as a Python extension", "unless you interrupt me (^C) in the next 10 seconds...", "", ])) for i in range(10,0,-1): sys.stdout.write('\r%2i...' % i) sys.stdout.flush() time.sleep(1) info("") return self.bundle_libzmq_extension()