diff options
author | Guido Günther <agx@sigxcpu.org> | 2020-02-02 18:38:48 +0100 |
---|---|---|
committer | Guido Günther <agx@sigxcpu.org> | 2020-02-02 18:39:31 +0100 |
commit | f8883ebcd9ab958fb763329bb3b62f33fba017e1 (patch) | |
tree | eef1d5e7eb68bf228d47e39188bbf07211b056d6 | |
parent | b80027c3eae4b553601cd2eaab587c349755fb90 (diff) |
config: Be less picky about comments after boolean values
This makes 'patch-numbers = False # comment' work.
Thanks: Mechtilde Stehmann for the report
-rw-r--r-- | gbp/config.py | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/gbp/config.py b/gbp/config.py index 495ec630..1ca8defd 100644 --- a/gbp/config.py +++ b/gbp/config.py @@ -620,12 +620,17 @@ class GbpOptionParser(OptionParser): except KeyError: default = self.config[neg] + default = default.strip() + parts = default.split(" ", 2) + if len(parts) > 1 and parts[1] == '#': + default = parts[0] + if default.lower() in ["true", "1"]: val = 'True' elif default.lower() in ["false", "0"]: val = 'False' else: - raise ValueError("Boolean options must be True or False") + raise ValueError("Boolean options must be True or False, not '%s'" % default) return eval(val) def get_default(self, option_name, **kwargs): |