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

Side by Side Diff: tools/telemetry/telemetry/core/command_line.py

Issue 955183003: Revert of [Telemetry] Pass test_runner environment in local args instead of a global variable (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 9 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 unified diff | Download patch
OLDNEW
1 # Copyright 2014 The Chromium Authors. All rights reserved. 1 # Copyright 2014 The Chromium Authors. All rights reserved.
2 # Use of this source code is governed by a BSD-style license that can be 2 # Use of this source code is governed by a BSD-style license that can be
3 # found in the LICENSE file. 3 # found in the LICENSE file.
4 4
5 import argparse 5 import argparse
6 import optparse 6 import optparse
7 7
8 from telemetry.core import camel_case 8 from telemetry.core import camel_case
9 9
10 10
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
57 57
58 # TODO: Convert everything to argparse. 58 # TODO: Convert everything to argparse.
59 class OptparseCommand(Command): 59 class OptparseCommand(Command):
60 usage = '' 60 usage = ''
61 61
62 @classmethod 62 @classmethod
63 def CreateParser(cls): 63 def CreateParser(cls):
64 return optparse.OptionParser('%%prog %s %s' % (cls.Name(), cls.usage), 64 return optparse.OptionParser('%%prog %s %s' % (cls.Name(), cls.usage),
65 description=cls.Description()) 65 description=cls.Description())
66 66
67 @classmethod
68 def AddCommandLineArgs(cls, parser, environment):
69 # pylint: disable=arguments-differ
70 pass
71
72 @classmethod
73 def ProcessCommandLineArgs(cls, parser, args, environment):
74 # pylint: disable=arguments-differ
75 pass
76
77 def Run(self, args): 67 def Run(self, args):
78 raise NotImplementedError() 68 raise NotImplementedError()
79 69
80 @classmethod 70 @classmethod
81 def main(cls, args=None): 71 def main(cls, args=None):
82 """Main method to run this command as a standalone script.""" 72 """Main method to run this command as a standalone script."""
83 parser = cls.CreateParser() 73 parser = cls.CreateParser()
84 cls.AddCommandLineArgs(parser) 74 cls.AddCommandLineArgs(parser)
85 options, args = parser.parse_args(args=args) 75 options, args = parser.parse_args(args=args)
86 options.positional_args = args 76 options.positional_args = args
(...skipping 25 matching lines...) Expand all
112 command.Name(), help=command.Description()) 102 command.Name(), help=command.Description())
113 subparser.set_defaults(command=command) 103 subparser.set_defaults(command=command)
114 command.AddCommandLineArgs(subparser) 104 command.AddCommandLineArgs(subparser)
115 105
116 @classmethod 106 @classmethod
117 def ProcessCommandLineArgs(cls, parser, args): 107 def ProcessCommandLineArgs(cls, parser, args):
118 args.command.ProcessCommandLineArgs(parser, args) 108 args.command.ProcessCommandLineArgs(parser, args)
119 109
120 def Run(self, args): 110 def Run(self, args):
121 return args.command().Run(args) 111 return args.command().Run(args)
OLDNEW
« no previous file with comments | « tools/telemetry/telemetry/benchmark_runner.py ('k') | tools/telemetry/telemetry/core/environment.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698