Changeset 76339 in webkit


Ignore:
Timestamp:
Jan 21, 2011 3:23:39 AM (13 years ago)
Author:
eric@webkit.org
Message:

2011-01-21 Eric Seidel <eric@webkit.org>

Reviewed by Adam Barth.

Split Host object off from WebKitPatch for easier re-use
https://bugs.webkit.org/show_bug.cgi?id=52284

new-run-webkit-tests and other tools are eventually going to want one of these.
Basically you need to inherit from this class if you want to pretend to be a
self.tool object for Steps/Commands.

  • Scripts/webkitpy/common/host.py: Added.
  • Scripts/webkitpy/tool/main.py:
Location:
trunk/Tools
Files:
1 added
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/Tools/ChangeLog

    r76326 r76339  
     12011-01-21  Eric Seidel  <eric@webkit.org>
     2
     3        Reviewed by Adam Barth.
     4
     5        Split Host object off from WebKitPatch for easier re-use
     6        https://bugs.webkit.org/show_bug.cgi?id=52284
     7
     8        new-run-webkit-tests and other tools are eventually going to want one of these.
     9        Basically you need to inherit from this class if you want to pretend to be a
     10        self.tool object for Steps/Commands.
     11
     12        * Scripts/webkitpy/common/host.py: Added.
     13        * Scripts/webkitpy/tool/main.py:
     14
    1152011-01-20  Dirk Pranke  <dpranke@chromium.org>
    216
  • trunk/Tools/Scripts/webkitpy/tool/main.py

    r75575 r76339  
    3737from webkitpy.common.checkout.scm import default_scm
    3838from webkitpy.common.config.ports import WebKitPort
     39from webkitpy.common.host import Host
    3940from webkitpy.common.net.bugzilla import Bugzilla
    4041from webkitpy.common.net.buildbot import BuildBot
     
    4748
    4849
    49 class WebKitPatch(MultiCommandTool):
     50class WebKitPatch(MultiCommandTool, Host):
    5051    global_options = [
    5152        make_option("-v", "--verbose", action="store_true", dest="verbose", default=False, help="enable all logging"),
     
    6061    def __init__(self, path):
    6162        MultiCommandTool.__init__(self)
     63        Host.__init__(self)
    6264
    6365        self._path = path
    6466        self.wakeup_event = threading.Event()
    65         # FIXME: All of these shared objects should move off onto a
    66         # separate "Tool" object.  WebKitPatch should inherit from
    67         # "Tool" and all these objects should use getters/setters instead of
    68         # manual getter functions (e.g. scm()).
    69         self.bugs = Bugzilla()
    70         self.buildbot = BuildBot()
    71         self.executive = executive.Executive()
    72         self._irc = None
    73         self.filesystem = filesystem.FileSystem()
    74         self.workspace = workspace.Workspace(self.filesystem, self.executive)
    75         self._port = None
    76         self.user = user.User()
    77         self._scm = None
    78         self._checkout = None
    79         self.status_server = StatusServer()
    80         self.port_factory = port.factory
    81         self.platform = platforminfo.PlatformInfo()
    82 
    83     def scm(self):
    84         # Lazily initialize SCM to not error-out before command line parsing (or when running non-scm commands).
    85         if not self._scm:
    86             self._scm = default_scm(self._options.patch_directories)
    87         return self._scm
    88 
    89     def checkout(self):
    90         if not self._checkout:
    91             self._checkout = Checkout(self.scm())
    92         return self._checkout
    93 
    94     def port(self):
    95         return self._port
    96 
    97     def ensure_irc_connected(self, irc_delegate):
    98         if not self._irc:
    99             self._irc = IRCProxy(irc_delegate)
    100 
    101     def irc(self):
    102         # We don't automatically construct IRCProxy here because constructing
    103         # IRCProxy actually connects to IRC.  We want clients to explicitly
    104         # connect to IRC.
    105         return self._irc
    10667
    10768    def path(self):
    10869        return self._path
    109 
    110     def command_completed(self):
    111         if self._irc:
    112             self._irc.disconnect()
    11370
    11471    def should_show_in_main_help(self, command):
     
    12178    # FIXME: This may be unnecessary since we pass global options to all commands during execute() as well.
    12279    def handle_global_options(self, options):
    123         self._options = options
     80        self._initialize_scm(options.patch_directories)
    12481        if options.dry_run:
    12582            self.scm().dryrun = True
Note: See TracChangeset for help on using the changeset viewer.