# HG changeset patch # User Jeff Hammel # Date 1354600195 28800 # Node ID 7495c25d8476922c228af853520f55957d6a40e7 # Parent 3eaee0d10880d87ef48237b5faaf2da709acc5f9 WIP diff -r 3eaee0d10880 -r 7495c25d8476 mozillatry.py --- a/mozillatry.py Sat Dec 01 23:05:19 2012 -0800 +++ b/mozillatry.py Mon Dec 03 21:49:55 2012 -0800 @@ -76,7 +76,8 @@ help='no debug builds') parser.add_option('-u', dest='unittests', action='append', help='unittests') - parser.add_option('-t', dest='talos', action='append', + parser.add_option('-t', dest='talostests', + action='append', help='talos tests') parser.add_option('--bug', dest='bug', type='int', help='post to bugzilla bug #') @@ -94,15 +95,27 @@ # e.g. http://k0s.org/mozilla/hg/configuration/ from ConfigParser import ConfigParser parser = ConfigParser() + if not os.path.exists(filename): + return parser parser.read(filename) if options.mozilla_central is None: try: path = parser.get('hg', 'mozilla-central') - os.path.expanduser(path) + if path: + options.mozilla_central = os.path.expanduser(path) except Exception: # XXX temporary hack pass return parser +def check(parser, options, args): + """check configuration""" + + if not args: + parser.print_help() + parser.exit() + if (not options.opt) and (not options.debug): + parser.error("Must enable opt or debug builds") + def main(args=sys.argv[1:]): @@ -119,19 +132,14 @@ parser = optparse.OptionParser(usage=usage, description=__doc__, formatter=PlainDescriptionFormatter()) add_options(parser) options, args = parser.parse_args(args) - if not args: - parser.print_help() - parser.exit() - if (not options.opt) and (not options.debug): - parser.error("Must enable opt or debug builds") + config_file = options.config + read_config(config_file) # get mozilla-central repository directory - config_file = options.__dict__.pop('config') if os.path.exists(config_file): - read_config(config_file) try_directory = options.mozilla_central if (try_directory is None) or (not os.path.exists(try_directory)): - parser.error("mozilla-central try directory does not exist: %s" % try_directory) + parser.error("mozilla-central directory does not exist: %s" % try_directory) # build try syntax commit = try_syntax(**options.__dict__)