[game-data-packager] 10/14: launcher: add support for launching expansions
Simon McVittie
smcv at debian.org
Fri Oct 14 00:09:50 UTC 2016
This is an automated email from the git hooks/post-receive script.
smcv pushed a commit to branch master
in repository game-data-packager.
commit d2e3d1da8ad89af1c5c9754effb7e0bc50d95be4
Author: Simon McVittie <smcv at debian.org>
Date: Wed Oct 12 11:16:27 2016 +0100
launcher: add support for launching expansions
---
runtime/launcher.py | 38 ++++++++++++++++++++++++++++++++++++++
1 file changed, 38 insertions(+)
diff --git a/runtime/launcher.py b/runtime/launcher.py
index 9c40cb4..4ea75eb 100755
--- a/runtime/launcher.py
+++ b/runtime/launcher.py
@@ -184,6 +184,8 @@ class Launcher:
help='identity of launched game (default: from argv[0])')
parser.add_argument('--engine', default=None,
help='use the specified game engine, if supported')
+ parser.add_argument('--expansion', default=None,
+ help='expansion to launch')
parser.add_argument('arguments', nargs='*',
help='arguments for the launched game')
self.args = parser.parse_args(argv)
@@ -203,6 +205,22 @@ class Launcher:
GLib.KEY_FILE_DESKTOP_KEY_ICON)
logger.debug('Icon: %s', self.icon_name)
+ self.expansion_name = self.args.expansion
+
+ try:
+ override_id = self.keyfile.get_string(GLib.KEY_FILE_DESKTOP_GROUP,
+ 'X-GameDataPackager-ExpansionFor')
+ except GLib.Error:
+ pass
+ else:
+ if self.expansion_name is None:
+ self.expansion_name = self.id
+
+ if self.expansion_name.startswith(override_id + '-'):
+ self.expansion_name = self.expansion_name[len(override_id) + 1:]
+
+ self.id = override_id
+
self.data = json.load(open('%s/launch-%s.json' % (RUNTIME_BUILT,
self.id), encoding='utf-8'))
@@ -265,6 +283,26 @@ class Launcher:
self.symlink_into_dot_directory +
data.get('symlink_into_dot_directory', []))
+ aliases = data.get('aliases', [])
+ if isinstance(aliases, str):
+ aliases = aliases.split()
+
+ if (self.expansion_name == expansion or
+ self.expansion_name in aliases):
+ extra_argv = data.get('extra_argv', [])
+ if isinstance(extra_argv, str):
+ extra_argv = extra_argv.split()
+ self.argv = self.argv + extra_argv
+
+ extra_required_files = data.get('extra_required_files', [])
+ if isinstance(extra_required_files, str):
+ extra_required_files = extra_required_files.split()
+ self.required_files = (self.required_files +
+ extra_required_files)
+
+ self.base_directories = base_directories
+ break
+
logger.debug('Arguments: %r', self.argv)
def check_required_files(self, base_directories, required_files,
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-games/game-data-packager.git
More information about the Pkg-games-commits
mailing list