Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(220)

Unified Diff: third_party/WebKit/Tools/Scripts/webkitpy/tool/multi_command_tool.py

Issue 2073893004: Reland of Use an explicit list of webkit-patch commands instead of using auto-discovery. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Remove parameter name, make parameter commands mandatory. Created 4 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/Tools/Scripts/webkitpy/tool/multi_command_tool.py
diff --git a/third_party/WebKit/Tools/Scripts/webkitpy/tool/multi_command_tool.py b/third_party/WebKit/Tools/Scripts/webkitpy/tool/multi_command_tool.py
index ad10d1a73f6d98b63afdbbd48bbd907037ad245d..4a55ac27d7492fdf6f04cb57378fe4c33fb9b37d 100644
--- a/third_party/WebKit/Tools/Scripts/webkitpy/tool/multi_command_tool.py
+++ b/third_party/WebKit/Tools/Scripts/webkitpy/tool/multi_command_tool.py
@@ -35,7 +35,6 @@ import optparse
import logging
import sys
-from webkitpy.tool.commands.command import Command
from webkitpy.tool.commands.command import HelpPrintingOptionParser
from webkitpy.tool.commands.help_command import HelpCommand
@@ -46,33 +45,20 @@ class MultiCommandTool(object):
global_options = None
- def __init__(self, name=None, commands=None):
- self._name = name or optparse.OptionParser(prog=name).get_prog_name() # OptionParser has nice logic for fetching the name.
- # Allow the unit tests to disable command auto-discovery.
- self.commands = commands or [cls() for cls in self._find_all_commands() if cls.name]
+ def __init__(self, commands):
+ self.commands = commands
self.help_command = self.command_by_name(HelpCommand.name)
- # Require a help command, even if the manual test list doesn't include one.
+ # Require the help command, even if the manual test list doesn't include one.
if not self.help_command:
self.help_command = HelpCommand()
self.commands.append(self.help_command)
+ # FIXME: Since tool is passed to Command.execute, it may not be necessary to set a tool attribute on the
+ # command objects here - maybe this should be done inside of Command.execute for commands that use self._tool.
for command in self.commands:
command.bind_to_tool(self)
- @classmethod
- def _add_all_subclasses(cls, class_to_crawl, seen_classes):
- for subclass in class_to_crawl.__subclasses__():
- if subclass not in seen_classes:
- seen_classes.add(subclass)
- cls._add_all_subclasses(subclass, seen_classes)
-
- @classmethod
- def _find_all_commands(cls):
- commands = set()
- cls._add_all_subclasses(Command, commands)
- return sorted(commands)
-
def name(self):
- return self._name
+ return optparse.OptionParser().get_prog_name()
def _create_option_parser(self):
usage = "Usage: %prog [options] COMMAND [ARGS]"

Powered by Google App Engine
This is Rietveld 408576698