class AbstractRebaseliningCommand(Command): # not overriding execute() - pylint: disable=W0223 move_overwritten_baselines_option = optparse.make_option( "--move-overwritten-baselines", action="store_true", default=False, help= "Move overwritten baselines elsewhere in the baseline path. This is for bringing up new ports." ) no_optimize_option = optparse.make_option( '--no-optimize', dest='optimize', action='store_false', default=True, help= ('Do not optimize/de-dup the expectations after rebaselining (default is to de-dup automatically). ' 'You can use "webkit-patch optimize-baselines" to optimize separately.' )) platform_options = factory.platform_options(use_globs=True) results_directory_option = optparse.make_option( "--results-directory", help="Local results directory to use") suffixes_option = optparse.make_option( "--suffixes", default=','.join(BASELINE_SUFFIX_LIST), action="store", help="Comma-separated-list of file types to rebaseline") def __init__(self, options=None): super(AbstractRebaseliningCommand, self).__init__(options=options) self._baseline_suffix_list = BASELINE_SUFFIX_LIST
class GardenOMatic(AbstractRebaseliningCommand): name = "garden-o-matic" help_text = "Command for gardening the WebKit tree." # REVIEW: Reset the option here because globbing isn't useful for us, but apparently # it's useful for other rebaselining commands because use_globs=True is set in parent. platform_options = factory.platform_options() def __init__(self): super(GardenOMatic, self).__init__(options=(self.platform_options + [ self.move_overwritten_baselines_option, self.results_directory_option, self.no_optimize_option, ])) def execute(self, options, args, tool): print( "This command runs a local HTTP server that changes your working copy" ) print("based on the actions you take in the web-based UI.") args = {} if options.platform: # FIXME: This assumes that the port implementation (chromium-, gtk-, etc.) is the first part of options.platform. args['platform'] = options.platform.split('-')[0] builder = builders.builder_name_for_port_name(options.platform) if builder: args['builder'] = builder if options.results_directory: args['useLocalResults'] = "true" httpd = GardeningHTTPServer(httpd_port=8127, config={ 'tool': tool, 'options': options }) self._tool.user.open_url(httpd.url(args)) print("Local HTTP server started.") httpd.serve_forever()