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

Side by Side Diff: server/autoserv_parser.py

Issue 6246035: Merge remote branch 'cros/upstream' into master (Closed) Base URL: ssh://git@gitrw.chromium.org:9222/autotest.git@master
Patch Set: patch Created 9 years, 10 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 | Annotate | Revision Log
OLDNEW
1 import os, sys, getopt, optparse 1 import os, sys, getopt, optparse
2 2
3 from autotest_lib.client.common_lib import host_protections, utils 3 from autotest_lib.client.common_lib import host_protections, utils
4 4
5 5
6 class base_autoserv_parser(object): 6 class base_autoserv_parser(object):
7 """Custom command-line options parser for autoserv. 7 """Custom command-line options parser for autoserv.
8 8
9 We can't use the general getopt methods here, as there will be unknown 9 We can't use the general getopt methods here, as there will be unknown
10 extra arguments that we pass down into the control file instead. 10 extra arguments that we pass down into the control file instead.
11 Thus we process the arguments by hand, for which we are duly repentant. 11 Thus we process the arguments by hand, for which we are duly repentant.
12 Making a single function here just makes it harder to read. Suck it up. 12 Making a single function here just makes it harder to read. Suck it up.
13 """ 13 """
14 def __init__(self): 14 def __init__(self):
15 self.args = sys.argv[1:] 15 self.args = sys.argv[1:]
16 self.parser = optparse.OptionParser() 16 self.parser = optparse.OptionParser(usage="%prog [options] [control-file ]")
17 self.setup_options() 17 self.setup_options()
18 18
19 # parse an empty list of arguments in order to set self.options 19 # parse an empty list of arguments in order to set self.options
20 # to default values so that codepaths that assume they are always 20 # to default values so that codepaths that assume they are always
21 # reached from an autoserv process (when they actually are not) 21 # reached from an autoserv process (when they actually are not)
22 # will still work 22 # will still work
23 self.options, self.args = self.parser.parse_args(args=[]) 23 self.options, self.args = self.parser.parse_args(args=[])
24 24
25 25
26 def setup_options(self): 26 def setup_options(self):
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after
143 site_autoserv_parser = utils.import_site_class( 143 site_autoserv_parser = utils.import_site_class(
144 __file__, "autotest_lib.server.site_autoserv_parser", 144 __file__, "autotest_lib.server.site_autoserv_parser",
145 "site_autoserv_parser", base_autoserv_parser) 145 "site_autoserv_parser", base_autoserv_parser)
146 146
147 class autoserv_parser(site_autoserv_parser): 147 class autoserv_parser(site_autoserv_parser):
148 pass 148 pass
149 149
150 150
151 # create the one and only one instance of autoserv_parser 151 # create the one and only one instance of autoserv_parser
152 autoserv_parser = autoserv_parser() 152 autoserv_parser = autoserv_parser()
OLDNEW
« cli/job.py ('K') | « server/autoserv ('k') | server/autotest.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698