def get_lib_tester() -> LibTestBase:
    if is_macos():
        return LibTestMac()
    if is_linux():
        return LibTestLinux()

    fatal(f"Unsupported platform: {platform.system()}")
Exemplo n.º 2
0
def _detect_linuxbrew() -> None:
    global g_linuxbrew_dir
    if not is_linux():
        log("Not using Linuxbrew -- this is not Linux")
        return

    linuxbrew_dir_from_env = os.getenv('YB_LINUXBREW_DIR')
    if linuxbrew_dir_from_env:
        g_linuxbrew_dir = linuxbrew_dir_from_env
        log(
            "Setting Linuxbrew directory based on YB_LINUXBREW_DIR env var: %s",
            linuxbrew_dir_from_env)
        return

    # if self.compiler_prefix:
    #     compiler_prefix_basename = os.path.basename(self.compiler_prefix)
    #     if compiler_prefix_basename.startswith('linuxbrew'):
    #         g_linuxbrew_dir = self.compiler_prefix
    #         log("Setting Linuxbrew directory based on compiler prefix %s",
    #             self.compiler_prefix)

    if g_linuxbrew_dir:
        log("Linuxbrew directory: %s", g_linuxbrew_dir)
        new_path_entry = os.path.join(g_linuxbrew_dir, 'bin')
        log("Adding PATH entry: %s", new_path_entry)
        add_path_entry(new_path_entry)
    else:
        log("Not using Linuxbrew")
Exemplo n.º 3
0
 def detect_clang_version(self) -> None:
     """
     Detects Clang version when the only compiler we are using is Clang. This is needed so we can
     use versions of components that are part of LLVM's repository that match the version of
     Clang.
     """
     if is_linux() and self.single_compiler_type == 'clang':
         self.find_compiler_by_type(self.single_compiler_type)
         self._identify_compiler_version()
Exemplo n.º 4
0
    def detect_linuxbrew(self) -> None:
        self.linuxbrew_dir = None
        if not is_linux():
            log("Not using Linuxbrew -- this is not Linux")
            return

        if self.single_compiler_type:
            log("Not using Linuxbrew, single_compiler_type is set to %s",
                self.single_compiler_type)
            return

        if self.compiler_suffix:
            log("Not using Linuxbrew, compiler_suffix is set to %s",
                self.compiler_suffix)
            return

        if self.compiler_prefix:
            compiler_prefix_basename = os.path.basename(self.compiler_prefix)
            if compiler_prefix_basename.startswith('linuxbrew'):
                self.linuxbrew_dir = self.compiler_prefix
                log("Setting Linuxbrew directory based on compiler prefix %s",
                    self.compiler_prefix)

        if self.linuxbrew_dir is None:
            linuxbrew_dir_from_env = os.getenv('YB_LINUXBREW_DIR')
            if linuxbrew_dir_from_env:
                self.linuxbrew_dir = linuxbrew_dir_from_env
                log(
                    "Setting Linuxbrew directory based on YB_LINUXBREW_DIR env var: %s",
                    linuxbrew_dir_from_env)

        if self.linuxbrew_dir:
            log("Linuxbrew directory: %s", self.linuxbrew_dir)
            new_path_entry = os.path.join(self.linuxbrew_dir, 'bin')
            log("Adding PATH entry: %s", new_path_entry)
            add_path_entry(new_path_entry)