예제 #1
0
    def is_installed(self, environ, version=None, strict=False):
        options.set_debug(self.debug)
        base_dirs = []
        limit = False
        if 'GRAPHVIZ_LIB_DIR' in environ and \
                environ['GRAPHVIZ_LIB_DIR']:
            base_dirs.append(environ['GRAPHVIZ_LIB_DIR'])
            limit = True
            if 'GRAPHVIZ_INCLUDE_DIR' in environ and \
                    environ['GRAPHVIZ_INCLUDE_DIR']:
                base_dirs.append(environ['GRAPHVIZ_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['GRAPHVIZ_ROOT'])
            except KeyError:
                pass
            for d in programfiles_directories():
                base_dirs.append(os.path.join(d, 'GnuWin32'))
                base_dirs += glob_insensitive(d, self.lib + '*')
            try:
                base_dirs.append(environ['MINGW_DIR'])
                base_dirs.append(environ['MSYS_DIR'])
            except KeyError:
                pass
        try:
            incl_dir = find_header(self.hdr, base_dirs, limit=limit)
            lib_dir, lib = find_library(self.lib, base_dirs, limit=limit)
            self.found = True
        except ConfigError:
            if self.debug:
                e = sys.exc_info()[1]
                print(e)
            return self.found

        self.environment['GRAPHVIZ_INCLUDE_DIR'] = incl_dir
        self.environment['GRAPHVIZ_LIB_DIR'] = lib_dir
        self.environment['GRAPHVIZ_SHLIB_DIR'] = lib_dir
        self.environment['GRAPHVIZ_LIB_FILES'] = [lib]
        self.environment['GRAPHVIZ_LIBRARIES'] = [self.lib]
        return self.found
예제 #2
0
    def is_installed(self, environ, version=None, strict=False):
        options.set_debug(self.debug)
        if 'MSVC' in environ:
            raise Exception('MinGW *and* MS Visual C both specified ' +
                            'as the chosen compiler.')
        limit = False
        if 'MINGW_DIR' in environ and environ['MINGW_DIR']:
            mingw_root = environ['MINGW_DIR']
            limit = True

        if not limit:
            try:
                mingw_root = os.environ['MINGW_ROOT']
            except KeyError:
                locations = [os.path.join('C:', os.sep, 'MinGW')]
                for d in programfiles_directories():
                    locations.append(os.path.join(d, 'MinGW'))
                try:
                    gcc = find_program('mingw32-gcc', locations)
                    mingw_root = os.path.abspath(os.path.join(
                            os.path.dirname(gcc), '..'))
                except ConfigError:
                    if self.debug:
                        print(sys.exc_info[1])
                    return self.found

        msys_root = os.path.join(mingw_root, 'msys', '1.0')
        try:
            
            gcc = find_program('mingw32-gcc', [mingw_root], limit=limit)
            gxx = find_program('mingw32-g++', [mingw_root], limit=limit)
            gfort = find_program('mingw32-gfortran', [mingw_root], limit=limit)
            self.found = True
        except ConfigError:
            if self.debug:
                print(sys.exc_info()[1])
            return self.found

        self.environment['MINGW_DIR']     = mingw_root
        self.environment['MSYS_DIR']      = msys_root
        self.environment['MINGW_CC']      = gcc
        self.environment['MINGW_CXX']     = gxx
        self.environment['MINGW_FORTRAN'] = gfort
        return self.found
예제 #3
0
    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
예제 #4
0
    def is_installed(self, environ, version=None, strict=False):
        if version is None:
            version = '3.1.2'
        options.set_debug(self.debug)
        limit = False
        antlr_root = None
        if 'ANTLR' in environ and environ['ANTLR']:
            antlr_root = environ['ANTLR']
            limit = True

        classpaths = []
        if not limit:
            try:
                pathlist = environ['CLASSPATH'] ## from java config
                for path in pathlist:
                    classpaths.append(os.path.dirname(path))
            except KeyError:
                pass
            try:
                antlr_root = os.environ['ANTLR_ROOT']
            except KeyError:
                pass
            for d in programfiles_directories():
                classpaths.append(os.path.join(d, 'ANTLR', 'lib'))

        try:
            java_home = None
            if 'JAVA_HOME' in environ.keys():
                java_home = os.path.join(environ['JAVA_HOME'], 'lib')
            jarfile = find_file('antlr*' + version[0] + '*.jar',
                                ['/usr/share/java', '/usr/local/share/java',
                                 '/opt/local/share/java', java_home,
                                 antlr_root,] + classpaths)
            self.environment['ANTLR'] = [environ['JAVA'],
                                         "-classpath", os.path.abspath(jarfile),
                                         "org.antlr.Tool",]
            self.found = True
        except ConfigError:
            if self.debug:
                print(sys.exc_info()[1])
        return self.found
예제 #5
0
    def is_installed(self, environ, version=None, strict=False):
        options.set_debug(self.debug)
        base_dirs = []
        if 'GIT' in environ and environ['GIT']:
            base_dirs.append(os.path.dirname(environ['GIT']))

        base_dirs.append(os.path.join('C:',  os.sep, 'msysgit', 'cmd'))
        for d in programfiles_directories():
            base_dirs.append(os.path.join(d, 'Git', 'cmd'))
        try:
            base_dirs.append(environ['MINGW_DIR'])
            base_dirs.append(environ['MSYS_DIR'])
        except KeyError:
            pass
        try:
            self.environment['GIT'] = find_program('git', base_dirs)
            self.found = True
        except ConfigError:
            if self.debug:
                print(sys.exc_info()[1])
        return self.found
예제 #6
0
    def is_installed(self, environ, version, strict=False):
        options.set_debug(self.debug)
        if 'MINGW_CC' in environ:
            raise Exception('MS Visual C *and* MinGW both specified ' +
                            'as the chosen compiler.')

        version, _, _ = get_msvc_version()
        dot_ver = '.'.join(version)

        vcvars = None
        nmake = None
        msvc = None

        msvc_dirs = []
        limit = False
        if 'MSVC' in environ and environ['MSVC']:
            msvc_dirs.append(os.path.dirname(environ['MSVC']))
            limit = True

        if not limit:
            for d in programfiles_directories():
                msvc_dirs.append(os.path.join(d,
                                              'Microsoft Visual Studio ' + dot_ver,
                                              'VC'))
        try:
            vcvars = find_program('vcvarsall', msvc_dirs, limit=limit)
            nmake = find_program('nmake', msvc_dirs, limit=limit)
            msvc = find_program('cl', msvc_dirs, limit=limit)
            self.found = True
        except ConfigError:
            if self.debug:
                print(sys.exc_info()[1])
            return self.found

        self.environment['MSVC_VARS'] = vcvars
        self.environment['NMAKE'] = nmake
        self.environment['MSVC'] = msvc
        return self.found
예제 #7
0
    def is_installed(self, environ, version=None, strict=False):
        options.set_debug(self.debug)
        limit = False
        base_dirs = []
        if 'GCCXML' in environ and environ['GCCXML']:
            base_dirs.append(os.path.dirname(environ['GCCXML']))
            limit = True

        if not limit:
            for d in programfiles_directories():
                base_dirs.append(os.path.join(d, 'GCC_XML'))
            try:
                base_dirs.append(environ['MINGW_DIR'])
                base_dirs.append(environ['MSYS_DIR'])
            except KeyError:
                pass
        try:
            self.environment['GCCXML'] = find_program('gccxml', base_dirs,
                                                      limit=limit)
            self.found = True
        except ConfigError:
            if self.debug:
                print(sys.exc_info()[1])
        return self.found
예제 #8
0
    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
예제 #9
0
    def is_installed(self, environ, version=None, strict=False):
        options.set_debug(self.debug)
        default_lib_paths = ['lib64', 'lib', '']
        default_include_paths = ['include', os.path.join(self.lib, 'include')]

        locations = [os.path.join(options.target_build_dir, d)
                     for d in default_include_paths + default_lib_paths]
        limit = False
        if self.lib.upper() + '_SHLIB_DIR' in environ and \
                environ[self.lib.upper() + '_SHLIB_DIR']:
            locations.append(environ[self.lib.upper() + '_SHLIB_DIR'])
        if self.lib.upper() + '_LIB_DIR' in environ and \
                environ[self.lib.upper() + '_LIB_DIR']:
            locations.append(environ[self.lib.upper() + '_LIB_DIR'])
            if self.lib.upper() + '_INCLUDE_DIR' in environ and \
                    environ[self.lib.upper() + '_INCLUDE_DIR']:
                locations.append(environ[self.lib.upper() + '_INCLUDE_DIR'])
                limit = True

        if not limit:
            try:
                locations += os.environ['LD_LIBRARY_PATH'].split(os.pathsep)
                locations += os.environ['LIBRARY_PATH'].split(os.pathsep)
                locations += os.environ['CPATH'].split(os.pathsep)
            except KeyError:
                pass
            try:
                locations.append(os.environ[self.lib.upper() + '_ROOT'])
            except KeyError:
                pass
            try:
                locations.append(os.environ[self.lib.upper() + '_LIBRARY_DIR'])
            except KeyError:
                pass
            for d in programfiles_directories():
                locations.append(os.path.join(d, 'GnuWin32'))
                locations += glob_insensitive(d, self.lib + '*')
            try:
                locations.append(environ['MINGW_DIR'])
                locations.append(environ['MSYS_DIR'])
            except KeyError:
                pass
        try:
            if self.hdr:
                subdirs = None
                if self.hdr_dir:
                    subdirs = [self.hdr_dir]
                incl_dir = find_header(self.hdr, locations, subdirs,
                                       limit=limit)
                default_lib_paths = ['lib64', 'lib', '']
                for lib in default_lib_paths:
                    locations.insert(0,
                                     os.path.abspath(os.path.join(incl_dir,
                                                                  '..', lib)))
            lib_dir, lib = find_library(self.lib, locations, limit=limit)
            def_dir, defs = lib_dir, []
            if 'windows' in platform.system().lower():
                def_dir, defs = find_definitions(self.lib, locations,
                                                 limit=limit)
            self.found = True
        except ConfigError:
            if self.debug:
                print(sys.exc_info()[1])
            return self.found

        if self.hdr:
            self.environment[self.lib.upper() + '_INCLUDE_DIR'] = incl_dir
        self.environment[self.lib.upper() + '_LIB_DIR'] = def_dir
        self.environment[self.lib.upper() + '_DEF_FILES'] = defs
        self.environment[self.lib.upper() + '_SHLIB_DIR'] = lib_dir
        self.environment[self.lib.upper() + '_LIB_FILES'] = [lib]
        self.environment[self.lib.upper() + '_LIBRARIES'] = [self.lib]
        return self.found
예제 #10
0
    def is_installed(self, environ, version=None, strict=False):
        options.set_debug(self.debug)
        msvcr_rel_dirs = []
        msvcr_dbg_dirs = []
        limit = False
        if 'MSVCRT_DIR' in environ and environ['MSVCRT_DIR']:
            msvcr_rel_dirs.append(environ['MSVCRT_DIR'])
            limit = True
            if 'MSVCRT_DEBUG_DIR' in environ and environ['MSVCRT_DEBUG_DIR']:
                msvcr_dbg_dirs.append(environ['MSVCRT_DEBUG_DIR'])

        version, _, _ = get_msvc_version()
        dot_ver = '.'.join(version)
        ver = ''.join(version)

        msvs_present = False
        if not limit:
            for d in programfiles_directories():
                msvcr_rel_dirs.append(
                    os.path.join(d, 'Microsoft Visual Studio ' + dot_ver,
                                 'VC', 'redist', 'x86',
                                 'Microsoft.VC' + ver + '.CRT'))
                msvcr_dbg_dirs.append(
                    os.path.join(d, 'Microsoft Visual Studio ' + dot_ver,
                                 'VC', 'redist', 'Debug_NonRedist', 'x86',
                                 'Microsoft.VC' + ver + '.DebugCRT'))
                if os.path.exists(
                    os.path.join(d, 'Microsoft Visual Studio ' + dot_ver)):
                    msvs_present = True

            if not msvs_present:
                try:
                    msvcr_rel_dirs.append(os.environ['MSVCRT_DIR'])
                except KeyError:
                    pass
                try:
                    msvcr_rel_dirs.append(os.environ['SYSTEM'])
                except KeyError:
                    pass
                try:
                    msvcr_rel_dirs.append(os.environ['WINDIR'])
                except KeyError:
                    pass
        release_dir = None
        debug_dir = None
        try:
            # Just the DLLs
            release_dir, _ = find_library('msvcr' + ver, msvcr_rel_dirs,
                                          limit=limit)
            if msvs_present:
                debug_dir, _ = find_library('msvcr' + ver, msvcr_dbg_dirs,
                                            limit=limit)
            self.found = True
        except ConfigError:
            if self.debug:
                print(sys.exc_info()[1])
            return self.found

        self.environment['MSVCRT_DIR'] = release_dir
        if msvs_present:
            self.environment['MSVCRT_DEBUG_DIR'] = debug_dir
        self.environment['MSVCRT_LIBRARIES'] = ['msvcr' + ver, 'msvcp' + ver]
        return self.found
예제 #11
0
    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