# HG changeset patch # User Jeff Hammel # Date 1354656159 28800 # Node ID 51d1167cc684c3a73008b25de521db1ee1536a93 # Parent 6f35d0d90c648264bd154f2df2168a05e0b885b1 something still wrong here but on the right track, i hope diff -r 6f35d0d90c64 -r 51d1167cc684 mozillatry.py --- a/mozillatry.py Tue Dec 04 11:16:14 2012 -0800 +++ b/mozillatry.py Tue Dec 04 13:22:39 2012 -0800 @@ -66,6 +66,11 @@ message += ['--post-to-bugzilla', 'Bug', str(bug)] return ' '.join(message) +### configuration parsing + +class ConfigurationError(Exception): + """error when checking configuration""" + class MozillaTryConfiguration(configuration.Configuration): usage = '%prog [options] patch <...>' @@ -87,14 +92,11 @@ def __init__(self): configuration.Configuration.__init__(self, usage=self.usage, load='--config') - def check(self, parser, options, args): + def check(self, config): """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") + if (not config.get('opt')) and (not config.get('debug')): + raise ConfigurationError("Must have opt or debug builds") def read_config(filename, options): @@ -123,6 +125,9 @@ # parse command line arguments parser = MozillaTryConfiguration() options, args = parser.parse_args() + if not args: + parser.print_usage() + parser.exit() # get mozilla-central repository directory try_directory = options.mozilla_central