示例#1
0
    def is_installed(self, environ, version=None, strict=False):
        options.set_debug(self.debug)
        lib_name = 'cdf'
        if 'windows' in platform.system().lower():
            lib_name += 'NativeLibrary'
        if version is None:
            version = '35_0'

        limit = False
        base_dirs = []
        if 'CDF_BASE' in environ and environ['CDF_BASE']:
            base_dirs.append(environ['CDF_BASE'])
            limit = True
        if 'CDF_LIB' in environ and environ['CDF_LIB']:
            base_dirs.append(environ['CDF_LIB'])
            limit = True
        if 'CDF_INC' in environ and environ['CDF_INC']:
            base_dirs.append(environ['CDF_INC'])
            limit = True
        if 'CDF_BIN' in environ and environ['CDF_BIN']:
            base_dirs.append(environ['CDF_BIN'])
            limit = True
        if 'CDF_LIB_DIR' in environ and environ['CDF_LIB_DIR']:
            base_dirs.append(environ['CDF_LIB_DIR'])
            limit = True
            if 'CDF_INCLUDE_DIR' in environ and environ['CDF_INCLUDE_DIR']:
                base_dirs.append(environ['CDF_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
            if 'windows' in platform.system().lower():
                base_dirs.append(os.path.join('C:', os.sep, 'CDF Distribution',
                                              'cdf' + version + '-dist'))
            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)
            exe = find_program('cdfcompare',  base_dirs)
            self.found = True
        except ConfigError:
            if self.debug:
                print(sys.exc_info()[1])
            return self.found

        self.environment['CDF_INCLUDE_DIR'] = incl_dir
        self.environment['CDF_LIB_DIR'] = lib_dir
        self.environment['CDF_LIB_FILES'] = [lib]
        self.environment['CDF_LIBRARIES'] = [lib_name]
        os.environ['CDF_LIB'] = os.path.abspath(lib_dir)
        os.environ['CDF_INC'] = os.path.abspath(incl_dir)
        os.environ['CDF_BIN'] = os.path.abspath(os.path.dirname(exe))
        return self.found
示例#2
0
 def is_installed(self, environ, version=None, strict=False):
     options.set_debug(self.debug)
     try:
         gomp_lib_dir, gomp_lib  = find_library('gomp')
         self.environment['GOMP_LIBRARY_DIR'] = gomp_lib_dir
         self.environment['GOMP_LIBRARY'] = gomp_lib
         self.found = True
     except ConfigError:
         if self.debug:
             print(sys.exc_info()[1])
     return self.found
示例#3
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
示例#4
0
    def is_installed(self, environ, version=None, strict=False):
        options.set_debug(self.debug)

        base_dirs = []
        limit = False
        if 'DL_LIB_DIR' in environ and environ['DL_LIB_DIR']:
            base_dirs.append(environ['DL_LIB_DIR'])
            limit = True
            if 'DL_INCLUDE_DIR' in environ and environ['DL_INCLUDE_DIR']:
                base_dirs.append(environ['DL_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(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, wildcard=False)
            self.found = True
        except ConfigError:
            if self.debug:
                e = sys.exc_info()[1]
                print(e)
            return self.found

        self.environment['DL_INCLUDE_DIR'] = incl_dir
        self.environment['DL_LIB_DIR'] = lib_dir
        self.environment['DL_SHLIB_DIR'] = lib_dir
        self.environment['DL_LIB_FILES'] = [lib]
        self.environment['DL_LIBRARIES'] = [self.lib]
        return self.found
    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
示例#6
0
    def is_installed(self, environ, version=None, strict=False):
        if version is None:
            ver = '5'
        else:
            ver = version.split('.')[0]

        options.set_debug(self.debug)
        lib_ver = ''
        base_dirs = []
        limit = False
        if 'PERL_LIB_DIR' in environ and environ['PERL_LIB_DIR']:
            base_dirs.append(environ['PERL_LIB_DIR'])
            limit = True
            if 'PERL_INCLUDE_DIR' in environ and environ['PERL_INCLUDE_DIR']:
                base_dirs.append(environ['PERL_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['PERL_CORE'])
            except KeyError:
                pass
            try:
                base_dirs.append(os.environ['PERL_ROOT'])
            except KeyError:
                pass
            if 'windows' in platform.system().lower():
                ## Strawberry Perl from http://strawberryperl.com
                base_dirs.append(os.path.join('C:', os.sep,
                                              'strawberry', 'perl'))
                try:
                    base_dirs.append(environ['MSYS_DIR'])  ## msys includes perl
                except KeyError:
                    pass
            elif 'darwin' in platform.system().lower():
                base_dirs.append(os.path.join('/', 'System', 'Library', 'Perl',
                                              ver + '*', 'darwin-*'))

        try:
            perl_exe = find_program('perl', base_dirs)
            incl_dir = find_header(self.hdr, base_dirs,
                                   ['CORE', os.path.join('lib', 'CORE'),
                                    os.path.join('perl', 'CORE'),
                                    os.path.join('perl' + ver, 'CORE'),
                                    os.path.join('lib', 'perl' + ver,
                                                 ver + '.*', 'msys', 'CORE'),
                                    ])
            lib_dir, perl_lib  = find_library(self.lib, base_dirs,
                                              [os.path.join('perl', 'bin'),
                                               incl_dir,])
            if 'windows' in platform.system().lower():
                lib_ver = perl_lib[0].split('.')[0].split('perl')[1]
            self.found = True
        except ConfigError:
            if self.debug:
                print(sys.exc_info()[1])
            return self.found

        self.environment['PERL'] = perl_exe
        self.environment['PERL_INCLUDE_DIR'] = incl_dir
        self.environment['PERL_LIB_DIR'] = lib_dir
        self.environment['PERL_LIBRARIES'] = ['perl' + lib_ver]
        self.environment['PERL_LIB_FILES'] = [perl_lib]
        return self.found
示例#7
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