Bug 1846065 - Exit DetermineCommandVenvAction early if unknown command so that it can be gracefully handled elsewhere r=firefox-build-system-reviewers,glandium

Differential Revision: https://phabricator.services.mozilla.com/D184851
This commit is contained in:
ahochheiden 2023-08-01 19:59:25 +00:00
parent 0e958eb592
commit 26bb1c1636

View File

@ -336,14 +336,20 @@ class DetermineCommandVenvAction(argparse.Action):
if command == "help":
return
site = "common"
command_reference = MACH_COMMANDS.get(command)
if not command_reference:
# If there's no match for the command in the dictionary it
# means that the command doesn't exist, or that it's misspelled.
# We exit early and let both scenarios be handled elsewhere.
return
if len(values) > 1:
potential_sub_command_name = values[1]
else:
potential_sub_command_name = None
module_path = Path(self.topsrcdir) / MACH_COMMANDS.get(command).module
module_path = Path(self.topsrcdir) / command_reference.module
module_dict = command_virtualenv_info_for_module(module_path)
command_dict = module_dict.get(command, {})