mirror of
https://github.com/lutris/lutris
synced 2024-09-04 23:13:35 +00:00
Accept 'src' as a valid parameter for extract
This commit is contained in:
parent
94f3fe31f9
commit
2785d97b5c
|
@ -37,10 +37,20 @@ class CommandsMixin(object):
|
||||||
if type(params) is str:
|
if type(params) is str:
|
||||||
params = [params]
|
params = [params]
|
||||||
for param in params:
|
for param in params:
|
||||||
if param not in command_data:
|
if isinstance(param, tuple):
|
||||||
raise ScriptingError('The "%s" parameter is mandatory for '
|
param_present = False
|
||||||
'the %s command' % (param, command_name),
|
for key in param:
|
||||||
command_data)
|
if key in command_data:
|
||||||
|
param_present = True
|
||||||
|
if not param_present:
|
||||||
|
raise ScriptingError('One of %s parameter is mandatory for '
|
||||||
|
'the %s command' % (' or '.join(param), command_name),
|
||||||
|
command_data)
|
||||||
|
else:
|
||||||
|
if param not in command_data:
|
||||||
|
raise ScriptingError('The %s parameter is mandatory for '
|
||||||
|
'the %s command' % (param, command_name),
|
||||||
|
command_data)
|
||||||
|
|
||||||
def check_md5(self, data):
|
def check_md5(self, data):
|
||||||
self._check_required_params(['file', 'value'], data, 'check_md5')
|
self._check_required_params(['file', 'value'], data, 'check_md5')
|
||||||
|
@ -127,8 +137,8 @@ class CommandsMixin(object):
|
||||||
|
|
||||||
def extract(self, data):
|
def extract(self, data):
|
||||||
"""Extract a file, guessing the compression method."""
|
"""Extract a file, guessing the compression method."""
|
||||||
self._check_required_params('file', data, 'extract')
|
self._check_required_params([('file', 'src')], data, 'extract')
|
||||||
filename = self._get_file(data['file'])
|
filename = self._get_file(data.get('file', data.get('src')))
|
||||||
if not filename:
|
if not filename:
|
||||||
filename = self._substitute(data['file'])
|
filename = self._substitute(data['file'])
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue