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 get_version(self, environ=dict()): base_dirs = [] limit = False if 'HDF5_LIB_DIR' in environ and environ['HDF5_LIB_DIR']: base_dirs.append(environ['HDF5_LIB_DIR']) limit = True if 'HDF5_INCLUDE_DIR' in environ and environ['HDF5_INCLUDE_DIR']: base_dirs.append(environ['HDF5_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: base_dirs.append(os.environ['HDF5_ROOT']) except KeyError: pass for d in programfiles_directories(): base_dirs.append(os.path.join(d, 'HDF_Group', 'HDF5')) try: base_dirs.append(environ['MINGW_DIR']) base_dirs.append(environ['MSYS_DIR']) except KeyError: pass hdf5_lib_dir, hdf5_libs = find_libraries(self.lib, base_dirs, limit=limit) hdf5_inc_dir = find_header(self.hdr, base_dirs, limit=limit) h = open(os.path.join(hdf5_inc_dir, 'H5public.h'), 'r') ver = None for line in h.readlines(): if 'H5_VERS_INFO' in line: pre = 'HDF5 library version: ' v_begin = line.find(pre) + len(pre) v_end = line.find('"', v_begin) ver = line[v_begin:v_end].strip() break h.close() return ver, hdf5_inc_dir, hdf5_lib_dir, hdf5_libs
def is_installed(self, environ, version=None, strict=False): options.set_debug(self.debug) base_dirs = [] limit = False if 'PROJ4_LIB_DIR' in environ and environ['PROJ4_LIB_DIR']: base_dirs.append(environ['PROJ4_LIB_DIR']) limit = True if 'PROJ4_INCLUDE_DIR' in environ and environ['PROJ4_INCLUDE_DIR']: base_dirs.append(environ['PROJ4_INCLUDE_DIR']) if not limit: try: base_dirs += os.environ['LD_LIBRARY_PATH'].split(os.pathsep) except KeyError: pass try: base_dirs.append(os.environ['PROJ4_ROOT']) except KeyError: pass if 'windows' in platform.system().lower(): base_dirs.append(os.path.join('C:', os.sep, 'OSGeo4W')) try: base_dirs.append(environ['MINGW_DIR']) base_dirs.append(environ['MSYS_DIR']) except KeyError: pass try: proj4_inc_dir = find_header(self.hdr, base_dirs) proj4_lib_dir, proj4_libs = find_libraries(self.lib, base_dirs) self.found = True except ConfigError: if self.debug: print(sys.exc_info()[1]) return self.found self.environment['PROJ4_INCLUDE_DIR'] = proj4_inc_dir self.environment['PROJ4_LIBRARY_DIR'] = proj4_lib_dir self.environment['PROJ4_LIBRARIES'] = ['proj'] self.environment['PROJ4_LIB_FILES'] = proj4_libs return self.found
def is_installed(self, environ, version=None, strict=False): options.set_debug(self.debug) openmpi_lib_list = ['mpi', 'mpi_cxx', 'mpi_f90'] arch = 'i686' if struct.calcsize('P') == 8: arch = 'x86_64' base_dirs = [] limit = False if 'OPENMPI_LIB_DIR' in environ and environ['OPENMPI_LIB_DIR']: base_dirs.append(environ['OPENMPI_LIB_DIR']) limit = True if 'OPENMPI_INCLUDE_DIR' in environ and environ['OPENMPI_INCLUDE_DIR']: base_dirs.append(environ['OPENMPI_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: base_dirs.append(os.environ['OPENMPI_ROOT']) except KeyError: pass for d in programfiles_directories(): base_dirs.append(os.path.join(d, 'OPENMPI')) try: base_dirs.append(environ['MINGW_DIR']) base_dirs.append(environ['MSYS_DIR']) except KeyError: pass try: subdirs = [os.path.join('openmpi', 'lib')] openmpi_lib_dir, openmpi_libs = find_libraries(openmpi_lib_list[0], base_dirs, subdirs) openmpi_inc_dir = find_header(self.hdr, base_dirs, ['openmpi', 'openmpi-' + arch,]) openmpi_exe = find_program('mpicc', base_dirs + [os.path.join(openmpi_lib_dir, '..')]) openmpi_exe_dir = os.path.abspath(os.path.dirname(openmpi_exe)) self.found = True except ConfigError: if self.debug: print(sys.exc_info()[1]) return self.found os.environ['PATH'] = os.environ.get('PATH', '') + \ os.pathsep + openmpi_exe_dir self.environment['OPENMPI_PATH'] = openmpi_exe_dir self.environment['OPENMPI_INCLUDE_DIR'] = openmpi_inc_dir self.environment['OPENMPI_LIB_DIR'] = openmpi_lib_dir self.environment['OPENMPI_LIBRARIES'] = openmpi_lib_list self.environment['OPENMPI_LIB_FILES'] = openmpi_libs try: p = subprocess.Popen([openmpi_exe, '-show'], stdout=subprocess.PIPE, stderr=subprocess.PIPE) out, err = p.communicate() if err != '': self.found = False return self.found self.environment['OPENMPI_FLAGS'] = out.split()[1:] except OSError: self.found = False 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
def is_installed(self, environ, version=None, strict=False): options.set_debug(self.debug) mpich_lib_list = ['mpich', 'mpichcxx', 'mpichf90'] if 'windows' in platform.system().lower(): mpich_lib_list = ['mpi', 'mpicxx', 'fmpich2g'] arch = 'i686' if struct.calcsize('P') == 8: arch = 'x86_64' base_dirs = [] limit = False if 'MPICH_LIB_DIR' in environ and environ['MPICH_LIB_DIR']: base_dirs.append(environ['MPICH_LIB_DIR']) limit = True if 'MPICH_INCLUDE_DIR' in environ and environ['MPICH_INCLUDE_DIR']: base_dirs.append(environ['MPICH_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: base_dirs.append(os.environ['MPICH_ROOT']) except KeyError: pass for d in programfiles_directories(): base_dirs.append(os.path.join(d, 'MPICH2')) try: base_dirs.append(environ['MINGW_DIR']) base_dirs.append(environ['MSYS_DIR']) except KeyError: pass try: mpich_lib_dir, mpich_libs = find_libraries(mpich_lib_list[0], base_dirs) mpich_inc_dir = find_header(self.hdr, base_dirs, ['mpich2', 'mpich2-' + arch,]) mpich_exe = find_program('mpicc', base_dirs + [os.path.join(mpich_lib_dir, '..')]) mpich_exe_dir = os.path.abspath(os.path.dirname(mpich_exe)) self.found = True except ConfigError: if self.debug: print(sys.exc_info()[1]) return self.found os.environ['PATH'] = os.environ.get('PATH', '') + \ os.pathsep + mpich_exe_dir self.environment['MPICH_PATH'] = mpich_exe_dir self.environment['MPICH_INCLUDE_DIR'] = mpich_inc_dir self.environment['MPICH_LIB_DIR'] = mpich_lib_dir self.environment['MPICH_LIBRARIES'] = mpich_lib_list self.environment['MPICH_LIB_FILES'] = mpich_libs try: p = subprocess.Popen([mpich_exe, '-compile_info', '-link_info'], stdout=subprocess.PIPE, stderr=subprocess.PIPE) out, err = p.communicate() if err != '': self.found = False return self.found self.environment['MPICH_FLAGS'] = out.split()[1:] except OSError: self.found = False return self.found