aboutsummaryrefslogtreecommitdiffhomepage
path: root/gbp/config.py
diff options
context:
space:
mode:
authorGuido Günther <agx@sigxcpu.org>2016-07-04 20:03:26 +0200
committerGuido Günther <agx@sigxcpu.org>2016-07-04 21:02:54 +0200
commitf545010462b9a313fe3bf160bca9e44c3ea77b55 (patch)
tree31c7f3a7d469b113c60b71d0f4d15bc459ea7c4c /gbp/config.py
parentf2ad919cb98b3e1b1a537e2a43ece88961006b29 (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/config.py')
-rw-r--r--gbp/config.py7
1 files changed, 6 insertions, 1 deletions
diff --git a/gbp/config.py b/gbp/config.py
index 3afd3a1f..a079447e 100644
--- a/gbp/config.py
+++ b/gbp/config.py
@@ -23,6 +23,7 @@ import errno
import os.path
import sys
+from gbp.errors import GbpError
try:
from gbp.version import gbp_version
@@ -509,9 +510,13 @@ class GbpOptionParser(OptionParser):
self.sections = sections
self.prefix = prefix
self.config = {}
- self.parse_config_files()
self.valid_options = []
+ try:
+ self.parse_config_files()
+ except configparser.ParsingError as err:
+ raise GbpError(str(err) + "\nSee 'man gbp.conf' for the format.")
+
OptionParser.__init__(self, option_class=GbpOption,
prog="gbp %s" % self.command,
usage=usage, version='%s %s' % (self.command,