mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 1139100 - Apply proper checking for command existence; r=ahal
Previously, we raised errors attempting to register a mach sub-command if the parent command was not defined on the Registrar. This broke B2G because its mach command Registrar imposes restrictions on which commands it exposes. Commands there were not getting registered on the Registrar, leading mach to give a false positive that the parent command was never defined. We change the verification logic to take present but unregistered commands into consideration and to skip registering sub-commands if the parent isn't present in the Registrar.
This commit is contained in:
parent
dee575a795
commit
989dd1896e
@ -47,6 +47,8 @@ def CommandProvider(cls):
|
||||
if len(spec.args) == 2:
|
||||
pass_context = True
|
||||
|
||||
seen_commands = set()
|
||||
|
||||
# We scan __dict__ because we only care about the classes own attributes,
|
||||
# not inherited ones. If we did inherited attributes, we could potentially
|
||||
# define commands multiple times. We also sort keys so commands defined in
|
||||
@ -63,6 +65,8 @@ def CommandProvider(cls):
|
||||
if command_name is None:
|
||||
continue
|
||||
|
||||
seen_commands.add(command_name)
|
||||
|
||||
if conditions is None and Registrar.require_conditions:
|
||||
continue
|
||||
|
||||
@ -106,10 +110,13 @@ def CommandProvider(cls):
|
||||
if not command:
|
||||
continue
|
||||
|
||||
if command not in Registrar.command_handlers:
|
||||
if command not in seen_commands:
|
||||
raise MachError('Command referenced by sub-command does not '
|
||||
'exist: %s' % command)
|
||||
|
||||
if command not in Registrar.command_handlers:
|
||||
continue
|
||||
|
||||
arguments = getattr(value, '_mach_command_args', None)
|
||||
argument_group_names = getattr(value, '_mach_command_arg_group_names', None)
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user