Mercurial > mozilla > hg > MozillaTry
changeset 7:51d1167cc684
something still wrong here but on the right track, i hope
author | Jeff Hammel <jhammel@mozilla.com> |
---|---|
date | Tue, 04 Dec 2012 13:22:39 -0800 |
parents | 6f35d0d90c64 |
children | 7423fa8b4343 |
files | mozillatry.py |
diffstat | 1 files changed, 11 insertions(+), 6 deletions(-) [+] |
line wrap: on
line diff
--- 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 <patch2> <...>' @@ -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