diff options
author | Guido Günther <agx@sigxcpu.org> | 2016-07-04 20:03:26 +0200 |
---|---|---|
committer | Guido Günther <agx@sigxcpu.org> | 2016-07-04 21:02:54 +0200 |
commit | f545010462b9a313fe3bf160bca9e44c3ea77b55 (patch) | |
tree | 31c7f3a7d469b113c60b71d0f4d15bc459ea7c4c /gbp/scripts/create_remote_repo.py | |
parent | f2ad919cb98b3e1b1a537e2a43ece88961006b29 (diff) |
Give more instructions when config is unparseable
and make return codes and messages consistent. This allows us to move
some test code from the component tests to the unit tests which is
always nice.
Closes: #733640
Diffstat (limited to 'gbp/scripts/create_remote_repo.py')
-rw-r--r-- | gbp/scripts/create_remote_repo.py | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/gbp/scripts/create_remote_repo.py b/gbp/scripts/create_remote_repo.py index db60959d..ffc32eaa 100644 --- a/gbp/scripts/create_remote_repo.py +++ b/gbp/scripts/create_remote_repo.py @@ -20,7 +20,6 @@ from __future__ import print_function -from six.moves import configparser import sys import os, os.path from six.moves import urllib @@ -36,8 +35,11 @@ from gbp.config import (GbpOptionParserDebian, GbpOptionGroup) from gbp.errors import GbpError from gbp.git import GitRepositoryError from gbp.deb.git import DebianGitRepository +from gbp.scripts.common import ExitCodes + import gbp.log + def print_config(remote, branches): """ Print out the git config to push to the newly created repo. @@ -237,7 +239,7 @@ def build_parser(name, sections=[]): usage='%prog [options] - ' 'create a remote repository', sections=sections) - except configparser.ParsingError as err: + except GbpError as err: gbp.log.err(err) return None @@ -308,11 +310,10 @@ def main(argv): changelog = 'debian/changelog' cmd = [] - try: - options, args = parse_args(argv) - except Exception as e: - print("%s" % e, file=sys.stderr) - return 1 + options, args = parse_args(argv) + + if not options: + return ExitCodes.parse_error gbp.log.setup(options.color, options.verbose, options.color_scheme) try: |