summaryrefslogtreecommitdiff
path: root/gbp/scripts/dch.py
diff options
context:
space:
mode:
authorGuido Günther <agx@sigxcpu.org>2014-04-02 22:13:46 +0200
committerGuido Günther <agx@sigxcpu.org>2014-04-03 20:34:07 +0200
commit459d9bfcce481b0da71e9493e644488c83e0e9ba (patch)
tree4fa6b653354cba87f5da0953b151d54af474a5bb /gbp/scripts/dch.py
parentb393080ac3b98342b53849d14049db024183f0cb (diff)
downloadgit-buildpackage-459d9bfcce481b0da71e9493e644488c83e0e9ba.tar.gz
git-buildpackage-459d9bfcce481b0da71e9493e644488c83e0e9ba.tar.bz2
git-buildpackage-459d9bfcce481b0da71e9493e644488c83e0e9ba.zip
config: add decorator to add_option_* functions
This allows us to build an internal list of valid options and print these.
Diffstat (limited to 'gbp/scripts/dch.py')
-rw-r--r--gbp/scripts/dch.py35
1 files changed, 25 insertions, 10 deletions
diff --git a/gbp/scripts/dch.py b/gbp/scripts/dch.py
index a848d6d2..f36f2877 100644
--- a/gbp/scripts/dch.py
+++ b/gbp/scripts/dch.py
@@ -283,20 +283,14 @@ def changelog_commit_msg(options, version):
return options.commit_msg % dict(version=version)
-def main(argv):
- ret = 0
- changelog = 'debian/changelog'
- until = 'HEAD'
- found_snapshot_banner = False
- version_change = {}
- branch = None
-
+def build_parser(name):
try:
- parser = GbpOptionParserDebian(command=os.path.basename(argv[0]), prefix='',
+ parser = GbpOptionParserDebian(command=os.path.basename(name),
usage='%prog [options] paths')
except ConfigParser.ParsingError as err:
gbp.log.err(err)
- return 1
+ return None
+
range_group = GbpOptionGroup(parser, "commit range options",
"which commits to add to the changelog")
version_group = GbpOptionGroup(parser, "release & version number options",
@@ -374,10 +368,31 @@ def main(argv):
dest="customization_file",
help=help_msg)
+
+ return parser
+
+
+def parse_args(argv):
+ parser = build_parser(argv[0])
+ if not parser:
+ return None, None
+
(options, args) = parser.parse_args(argv[1:])
gbp.log.setup(options.color, options.verbose, options.color_scheme)
dch_options = process_options(options, parser)
editor_cmd = process_editor_option(options)
+ return options, args, dch_options, editor_cmd
+
+def main(argv):
+ ret = 0
+ changelog = 'debian/changelog'
+ until = 'HEAD'
+ found_snapshot_banner = False
+ version_change = {}
+ branch = None
+
+
+ options, args, dch_options, editor_cmd = parse_args(argv)
try:
try: