Exemple #1
0
def install(force: bool) -> None:
    """
    Install all the necessary above programs and modules

    :param force: force installation if package is already installed
    :raise subprocess.CalledProcessError on error
    """
    logging.info("Installing required programs and modules")
    packages_to_install = set(get_global_conf().getlist("install", "dependencies"))

    if get_global_conf().getboolean("install", "module_handling"):
        packages_to_install.add("python3-pip")  # pylint: disable=no-member

    compiler = get_global_conf().get("install", "compiler")
    compiler_conf = get_compiler_conf(*compiler.split("."))

    for section in compiler_conf.sections():
        if section in ["env", "install"]:
            continue

        packages_to_install.update(compiler_conf[section].getlist("depend", fallback=[]))

    packages_to_install.update(get_programs_dependencies())
    packages_to_install.update(compiler_conf.getlist("install", "depend", fallback=[]))

    dependency_installer.DependenciesInstaller.factory(list(packages_to_install)).run()

    Installer.factory(compiler_conf["install"], force).run()

    if get_global_conf().getboolean("install", "module_handling"):
        install_python_modules()

    if get_global_conf().getboolean("install", "llvm_bitcode"):
        install_wllvm(force)
Exemple #2
0
    def prepare_env(self) -> dict:
        """
        Sets up the environment depending on the compiler chosen
        :return: the environment to use
        """
        env = os.environ.copy()
        env["PREFIX"] = self.install_dir

        # if we are configuring utilities, stop here, we already have set everything necessary
        if self.conf.getboolean("utility"):
            return env

        compiler_full_name = get_global_conf().get("install", "compiler")
        compiler_package, compiler_name = compiler_full_name.split(".")
        compiler_conf = get_compiler_conf(compiler_package, compiler_name)

        for env_name, env_value in compiler_conf.items("env"):
            if env_name.upper() == "PATH":
                env[env_name.upper()] = "{}:{}".format(env_value, env["PATH"])
            else:
                env[env_name.upper()] = env_value

        env["CFLAGS"] = env.get("CFLAGS", "") + " -g "
        env["CXXFLAGS"] = env.get("CXXFLAGS", "") + " -g "

        if get_global_conf().getboolean("install", "llvm_bitcode"):
            env["PATH"] = "{}:{}".format(
                os.path.join(
                    get_global_conf().getdir("utilities", "install_directory"),
                    "wllvm"), env["PATH"])

            env["LLVM_COMPILER"] = "clang"
            env["CC"] = "wllvm"
            env["CXX"] = "wllvm++"
        return env
Exemple #3
0
    def prepare_env(self) -> dict:
        """
        Sets up the environment depending on the compiler chosen
        :return: the environment to use
        """
        env = os.environ.copy()
        env["PREFIX"] = self.install_dir

        # if we are configuring utilities, stop here, we already have set everything necessary
        if self.conf.getboolean("utility"):
            return env

        compiler_full_name = get_global_conf().get("install", "compiler")
        compiler_package, compiler_name = compiler_full_name.split(".")
        compiler_conf = get_compiler_conf(compiler_package, compiler_name)

        for env_name, env_value in compiler_conf.items("env"):
            if env_name.upper() == "PATH":
                env[env_name.upper()] = "{}:{}".format(env_value, env["PATH"])
            else:
                env[env_name.upper()] = env_value

        env["CFLAGS"] = env.get("CFLAGS", "") + " -g "
        env["CXXFLAGS"] = env.get("CXXFLAGS", "") + " -g "

        if get_global_conf().getboolean("install", "llvm_bitcode"):
            env["PATH"] = "{}:{}".format(
                os.path.join(get_global_conf().getdir("utilities", "install_directory"), "wllvm"),
                env["PATH"]
            )

            env["LLVM_COMPILER"] = "clang"
            env["CC"] = "wllvm"
            env["CXX"] = "wllvm++"
        return env