Beispiel #1
0
    def get_runners_to_install(self):
        """Check if the runner is installed before starting the installation
        Install the required runner(s) if necessary. This should handle runner
        dependencies (wine for winesteam) or runners used for installer tasks.
        """
        runners_to_install = []
        required_runners = []
        runner = self.get_runner_class(self.installer.runner)
        required_runners.append(runner())

        for command in self.installer.script.get("installer", []):
            command_name, command_params = self._get_command_name_and_params(
                command)
            if command_name == "task":
                runner_name, _task_name = self._get_task_runner_and_name(
                    command_params["name"])
                runner_names = [r.name for r in required_runners]
                if runner_name not in runner_names:
                    required_runners.append(
                        self.get_runner_class(runner_name)())

        for runner in required_runners:
            params = {}
            if self.installer.runner == "libretro":
                params["core"] = self.installer.script["game"]["core"]
            if self.installer.runner.startswith("wine"):
                # Force the wine version to be installed
                params["fallback"] = False
                params["min_version"] = wine.MIN_SAFE_VERSION
                version = self._get_runner_version()
                if version:
                    params["version"] = version
                else:
                    # Looking up default wine version
                    default_wine = runner.get_runner_version() or {}
                    if "version" in default_wine:
                        logger.debug("Default wine version is %s",
                                     default_wine["version"])
                        # Set the version to both the is_installed params and
                        # the script itself so the version gets saved at the
                        # end of the install.
                        if self.installer.runner not in self.installer.script:
                            self.installer.script[self.installer.runner] = {}
                        version = "{}-{}".format(default_wine["version"],
                                                 default_wine["architecture"])
                        params["version"] = \
                            self.installer.script[self.installer.runner]["version"] = version
                    else:
                        logger.error(
                            "Failed to get default wine version (got %s)",
                            default_wine)

            if not runner.is_installed(**params):
                logger.info("Runner %s needs to be installed", runner)
                runners_to_install.append(runner)

        if self.installer.runner.startswith(
                "wine") and not get_system_wine_version():
            WineNotInstalledWarning(parent=self.parent)
        return runners_to_install
Beispiel #2
0
    def check_runner_install(self):
        """Check if the runner is installed before starting the installation
        Install the required runner(s) if necessary. This should handle runner
        dependencies (wine for winesteam) or runners used for installer tasks.
        """
        required_runners = []
        runner = self.get_runner_class(self.runner)
        if runner.depends_on is not None:
            required_runners.append(runner.depends_on())
        required_runners.append(runner())

        for command in self.script.get("installer", []):
            command_name, command_params = self._get_command_name_and_params(command)
            if command_name == "task":
                runner_name, _task_name = self._get_task_runner_and_name(
                    command_params["name"]
                )
                runner_names = [r.name for r in required_runners]
                if runner_name not in runner_names:
                    required_runners.append(self.get_runner_class(runner_name)())

        logger.debug("Required runners: %s", required_runners)
        for runner in required_runners:
            params = {}
            if self.runner == "libretro":
                params["core"] = self.script["game"]["core"]
            if self.runner.startswith("wine"):
                # Force the wine version to be installed
                params["fallback"] = False
                params["min_version"] = wine.MIN_SAFE_VERSION
                version = self._get_runner_version()
                if version:
                    params["version"] = version
                elif runner.get_version(use_default=False) != "system":
                    # Looking up default wine version
                    default_wine = runner.get_runner_version()
                    logger.debug("Default wine version is %s", default_wine["version"])
                    params["version"] = default_wine["version"] + "-" + default_wine["architecture"]

            if not runner.is_installed(**params):
                logger.debug("Runner %s needs to be installed")
                self.runners_to_install.append(runner)

        if self.runner.startswith("wine") and not get_system_wine_version():
            WineNotInstalledWarning(parent=self.parent)
        self.install_runners()
Beispiel #3
0
    def check_runner_install(self):
        """Check if the runner is installed before starting the installation
        Install the required runner(s) if necessary. This should handle runner
        dependencies (wine for winesteam) or runners used for installer tasks.
        """
        required_runners = []
        runner = self.get_runner_class(self.runner)
        if runner.depends_on is not None:
            required_runners.append(runner.depends_on())
        required_runners.append(runner())

        for command in self.script.get('installer', []):
            command_name, command_params = self._get_command_name_and_params(
                command)
            if command_name == 'task':
                runner_name, _task_name = self._get_task_runner_and_name(
                    command_params['name'])
                runner_names = [r.name for r in required_runners]
                if runner_name not in runner_names:
                    required_runners.append(
                        self.get_runner_class(runner_name)())

        for runner in required_runners:
            params = {}
            if self.runner == 'libretro':
                params['core'] = self.script['game']['core']
            if self.runner.startswith('wine'):
                params['min_version'] = wine.MIN_SAFE_VERSION
                version = self._get_runner_version()
                if version:
                    params['version'] = version
                    # Force the wine version to be installed
                    params['fallback'] = False
            if not runner.is_installed(**params):
                self.runners_to_install.append(runner)

        if self.runner.startswith('wine') and not get_system_wine_version():
            WineNotInstalledWarning(parent=self.parent)
        self.install_runners()