Commit 646176ad authored by Simon McVittie's avatar Simon McVittie

runtime: If extra_required_files is a string, split it on whitespace

This shortcut matches one that is frequently taken in the main part
of g-d-p.

In particular this fixes detection of the aopfm addon for Quake.
Signed-off-by: Simon McVittie's avatarSimon McVittie <smcv@debian.org>
parent 15ce8ca2
......@@ -5,6 +5,7 @@ game-data-packager (61) UNRELEASED; urgency=medium
hexen2demo_nov1997-linux-i586.tgz (LP: #1781449) [smcv]
* Bug fixes:
- lgeneral: Fix arguments of prepare_packages() [smcv]
- quake: Fix detection of aopfm when launching Quake [smcv]
-- Simon McVittie <smcv@debian.org> Sun, 04 Nov 2018 23:12:15 +0000
......
......@@ -77,6 +77,14 @@ def expand(path, **kwargs):
return os.path.expanduser(string.Template(path).substitute(os.environ,
**kwargs))
def force_list(x):
if isinstance(x, str):
return x.split()
else:
return list(x)
class Launcher:
def __init__(self, argv=None):
name = os.path.basename(sys.argv[0])
......@@ -130,7 +138,7 @@ class Launcher:
self.package = self.data.get('package', self.id)
self.binary_only = self.data.get('binary_only', False)
logger.debug('Binary-only: %r', self.binary_only)
self.required_files = self.data['required_files']
self.required_files = force_list(self.data['required_files'])
logger.debug('Checked files: %r', sorted(self.required_files))
self.dot_directory = expand(self.data.get('dot_directory',
......@@ -216,7 +224,7 @@ class Launcher:
[]))) + self.base_directories
if self.check_required_files(base_directories,
data.get('extra_required_files', [])):
force_list(data.get('extra_required_files', []))):
self.symlink_into_dot_directory = (
self.symlink_into_dot_directory +
data.get('symlink_into_dot_directory', []))
......@@ -232,9 +240,8 @@ class Launcher:
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()
extra_required_files = force_list(
data.get('extra_required_files', []))
self.required_files = (self.required_files +
extra_required_files)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment