def is_installed(self, environ, version=None, strict=False): options.set_debug(self.debug) try: ver, hdf5_inc_dir, \ hdf5_lib_dir, hdf5_libs = self.get_version(environ) not_ok = (compare_versions(ver, version) == -1) if strict: not_ok = (compare_versions(ver, version) != 0) if not_ok: if self.debug: print('Wrong version of ' + self.lib + ': ' + str(ver) + ' vs ' + str(version)) self.found = False return self.found self.found = True except ConfigError: if self.debug: print(sys.exc_info()[1]) return self.found hdf5_lib_list = ['hdf5', 'hdf5_fortran', 'hdf5_cpp', 'hdf5_hl', 'hdf5hl_fortran', 'hdf5_hl_cpp',] if 'windows' in platform.system().lower(): hdf5_lib_list = ['hdf5dll', 'hdf5_fortrandll', 'hdf5_cppdll', 'hdf5_hldll', 'hdf5_hl_fortrandll', 'hdf5_hl_cppdll',] self.environment['HDF5_INCLUDE_DIR'] = hdf5_inc_dir self.environment['HDF5_LIB_DIR'] = hdf5_lib_dir self.environment['HDF5_LIB_FILES'] = hdf5_libs self.environment['HDF5_LIBRARIES'] = hdf5_lib_list return self.found
def is_installed(self, environ, version=None, strict=False): try: from mpl_toolkits import basemap ver = basemap.__version__ not_ok = (compare_versions(ver, version) == -1) if strict: not_ok = (compare_versions(ver, version) != 0) if not_ok: if self.debug: print('Wrong version of ' + self.pkg + ': ' + str(ver) + ' vs ' + str(version)) return self.found self.found = True except ImportError: if self.debug: print(sys.exc_info()[1]) return self.found self.environment['BASEMAP_DATA_PATHLIST'] = self.basemap_data_pathlist basemap_dir = os.path.dirname(basemap.__file__) self.environment['BASEMAP_DIR'] = basemap_dir self.environment['BASEMAP_DATA_FILES'] = \ [(self.basemap_data_dir, glob.glob(os.path.join(basemap_dir, 'data', '*.*')))] return self.found
def check_version(self, module, version, strict): do_check = False if hasattr(module, '__version__'): ver = module.__version__ do_check = True elif hasattr(module, 'VERSION'): ver = module.VERSION do_check = True elif hasattr(module, 'version'): if isinstance(module.version, ModuleType): return self.check_version(module.version, version, strict) elif type(module.version) == type(''): ver = module.version do_check = True if do_check: not_ok = compare_versions(ver, version) == -1 if strict: not_ok = compare_versions(ver, version) != 0 if not_ok: self.found = False if self.debug: sys.stderr.write('Wrong version of ' + self.pkg + ': ' + str(ver) + ' vs ' + str(version) + ' ') return False return True
def is_installed(self, environ, version=None, strict=False): options.set_debug(self.debug) locations = [] limit = False if 'GEOS_LIB_DIR' in environ and environ['GEOS_LIB_DIR']: locations.append(environ['GEOS_LIB_DIR']) limit = True if 'GEOS_INCLUDE_DIR' in environ and environ['GEOS_INCLUDE_DIR']: locations.append(environ['GEOS_INCLUDE_DIR']) if not limit: try: locations += os.environ['LD_LIBRARY_PATH'].split(os.pathsep) except KeyError: pass try: locations.append(os.environ['GEOS_ROOT']) except KeyError: pass if 'windows' in platform.system().lower(): locations.append(os.path.join('C:', os.sep, 'OSGeo4W')) try: locations.append(environ['MINGW_DIR']) locations.append(environ['MSYS_DIR']) except KeyError: pass try: lib_dir, libs = find_libraries(self.lib, locations, limit=limit) inc_dir = find_header(self.hdr, locations, limit=limit) quoted_ver = get_header_version(os.path.join(inc_dir, self.hdr), 'GEOS_VERSION ') ver = quoted_ver[1:-1] not_ok = (compare_versions(ver, version) == -1) if strict: not_ok = (compare_versions(ver, version) != 0) if not_ok: if self.debug: print('Wrong version of ' + self.lib + ': ' + str(ver) + ' vs ' + str(version)) return self.found self.found = True except ConfigError: if self.debug: e = sys.exc_info()[1] print(e) return self.found self.environment['GEOS_INCLUDE_DIR'] = inc_dir self.environment['GEOS_LIBRARY_DIR'] = lib_dir self.environment['GEOS_LIBRARIES'] = ['geos', ' geos_c',] self.environment['GEOS_LIB_FILES'] = libs return self.found
def is_installed(self, environ, version=None, strict=False): try: import PIL.Image ver = PIL.Image.VERSION not_ok = (compare_versions(ver, version) == -1) if strict: not_ok = (compare_versions(ver, version) != 0) if not_ok: if self.debug: print('Wrong version of ' + self.pkg + ': ' + str(ver) + ' vs ' + str(version)) return self.found self.found = True except ImportError: if self.debug: print(sys.exc_info()[1]) return self.found
def earliest_version(what, website, pattern, requested='9999999999', archives=False): version = requested versions = available_versions(what, website, pattern, archives) for ver in versions: if compare_versions(version, ver) > 0: version = ver if requested in versions: return requested return version
def is_installed(self, environ, version=None, strict=False): options.set_debug(self.debug) try: import wxglade.common ver = wxglade.common.version not_ok = (compare_versions(ver, version) == -1) if strict: not_ok = (compare_versions(ver, version) != 0) if not_ok: if self.debug: print('Wrong version of wxGlade: ' + str(ver) + ' vs ' + str(version)) return self.found self.environment['WXGLADE'] = find_program('wxglade') self.found = True except (ImportError, ConfigError): if self.debug: print(sys.exc_info()[1]) return self.found
def is_installed(self, environ, version=None, strict=False): options.set_debug(self.debug) try: import matplotlib ver = matplotlib.__version__ not_ok = (compare_versions(ver, version) == -1) if strict: not_ok = (compare_versions(ver, version) != 0) if not_ok: if self.debug: print('Wrong version of ' + self.pkg + ': ' + str(ver) + ' vs ' + str(version)) return self.found self.found = True except ImportError: if self.debug: print(sys.exc_info()[1]) return self.found self.environment['MATPLOTLIB_DATA_FILES'] = \ matplotlib.get_py2exe_datafiles() return self.found
def is_installed(self, environ, version=None, strict=False): if version is None: required_version = "1_44_0" else: required_version = version.replace(".", "_") # TODO not detecting if boost installed options.set_debug(self.debug) base_dirs = [] limit = False if "BOOST_LIB_DIR" in environ and environ["BOOST_LIB_DIR"]: base_dirs.append(environ["BOOST_LIB_DIR"]) limit = True if "BOOST_INCLUDE_DIR" in environ and environ["BOOST_INCLUDE_DIR"]: base_dirs.append(environ["BOOST_INCLUDE_DIR"]) if not limit: try: base_dirs += os.environ["LD_LIBRARY_PATH"].split(os.pathsep) base_dirs += os.environ["CPATH"].split(os.pathsep) except KeyError: pass try: boost_root = os.environ["BOOST_ROOT"] boost_root = boost_root.strip('"') if os.path.exists(os.path.join(boost_root, "stage", "lib")): base_dirs.append(os.path.join(boost_root, "stage")) base_dirs.append(boost_root) except KeyError: pass try: base_dirs.append(os.environ["BOOST_LIBRARY_DIR"]) except KeyError: pass try: base_dirs.append(environ["MINGW_DIR"]) base_dirs.append(environ["MSYS_DIR"]) except KeyError: pass try: incl_dir = find_header(os.path.join("boost", "version.hpp"), base_dirs, ["boost-*"], limit=limit) lib_dir, libs = find_libraries("boost", base_dirs, limit=limit) # TODO boost lib_dir is wrong in windows (maybe) boost_version = get_header_version(os.path.join(incl_dir, "boost", "version.hpp"), "BOOST_LIB_VERSION") boost_version = boost_version.strip('"') not_ok = compare_versions(boost_version, required_version) == -1 if strict: not_ok = compare_versions(boost_version, required_version) != 0 if not_ok: if self.debug: print("Wrong version of Boost: " + str(boost_version) + " vs " + str(required_version)) return self.found self.found = True except ConfigError: if self.debug: print(sys.exc_info()[1]) return self.found self.environment["BOOST_INCLUDE_DIR"] = incl_dir self.environment["BOOST_LIB_DIR"] = lib_dir self.environment["BOOST_LIB_FILES"] = libs self.environment["BOOST_LIBRARIES"] = [ "boost_python", "boost_date_time", "boost_filesystem", "boost_graph", "boost_iostreams", "boost_prg_exec_monitor", "boost_program_options", "boost_regex", "boost_serialization", "boost_signals", "boost_system", "boost_thread", "boost_unit_test_framework", "boost_wave", "boost_wserialization", ] return self.found