Coverage for lutris.runners.runner : 48%

Hot-keys on this page
r m x p toggle line displays
j k next/prev highlighted chunk
0 (zero) top of page
1 (one) first highlighted chunk
# -*- coding:Utf-8 -*-
elif '86' in machine: return 'i386'
"""Generic runner (base class for other runners) """ """ Initialize runner """
def description(self): """Return the class' docstring as the description""" return self.__doc__
def description(self, value): """Leave the ability to override the docstring"""
def name(self):
def default_config(self): return LutrisConfig(runner=self.name)
def runner_config(self): config = self.default_config.runner_config[self.name] if self.settings[self.name]: config.update(self.settings[self.name])
def default_path(self): """ Return the default path where games are installed """ config = self.default_config.get('system') if config: return config.get('game_path')
def machine(self):
""" Load a game """ self.game = game
"""dummy method, must be implemented by derived runnners"""
"""Check if all the dependencies for a runner are installed."""
classname = "lutris.runners.%s" % str(self.depends) module = ".".join(parts[:-1]) for component in parts[1:]: module = getattr(module, component) runner = getattr(module, str(self.depends)) runner_instance = runner() return runner_instance.is_installed()
"""Return True if runner is installed else False""" return False return True else:
""" Return the directory where the game is installed. """ if hasattr(self, 'game_path'): return self.game_path else: system_settings = self.settings.get('system') if system_settings: return system_settings.get('game_path')
"""checks the md5sum of a file, does not belong here""" logger.warning("please remove md5sum from Runner") md5check = hashlib.md5() file_ = open(filename, "rb") content = file_.readlines() file_.close() for line in content: md5check.update(line) return md5check.hexdigest()
"""Install runner using package management systems."""
# Return false if runner has no package, must be then another method # and install method should be overridden by the specific runner if not hasattr(self, 'package'): return False if self.is_installable is False: ErrorDialog('This runner is not yet installable') return False
'gpk-install-package-name' 'software-center', ) package_installer = None for candidate in package_installer_candidates: if find_executable(candidate): package_installer = candidate break
if not package_installer: logger.error("The distribution you're running is not supported.")
if not self.package: ErrorDialog('This runner is not yet installable') logger.error("The requested runner %s can't be installed", self.__class__.__name__) return False
subprocess.Popen("%s %s" % (package_installer, self.package), shell=True, stderr=subprocess.PIPE) return True
runner_archive = os.path.join(settings.CACHE_DIR, tarball)
dialog = DownloadDialog(settings.RUNNERS_URL + tarball, runner_archive) dialog.run()
extract_archive(runner_archive, settings.RUNNER_DIR, merge_single=False) os.remove(runner_archive)
"""Write game configuration to settings directory.""" system = self.__class__.__name__ index = fullpath.rindex("/") exe = fullpath[index + 1:] path = fullpath[:index] if path.startswith("file://"): path = path[7:] config = LutrisConfig() config.config = { "main": { "path": path, "exe": exe, "realname": name, "runner": system } } config.save(config_type="game") |