aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorGuido Günther <agx@sigxcpu.org>2014-03-29 00:07:29 +0100
committerGuido Günther <agx@sigxcpu.org>2014-03-29 00:16:48 +0100
commit89f3005c606c80ff79ef7f52694104c891555ec3 (patch)
tree483a6759269ee5458d64360461c3b19a8f50c85d
parent8358f1dcc77633c97a096ef6a93998f4099237c4 (diff)
Use a much simpler version to fix the command name in --help
mostly reverting e1780f0. Closes: #742907
-rw-r--r--gbp/config.py14
-rwxr-xr-xgbp/scripts/buildpackage.py2
-rwxr-xr-xgbp/scripts/clone.py3
-rw-r--r--gbp/scripts/create_remote_repo.py3
-rw-r--r--gbp/scripts/dch.py3
-rw-r--r--gbp/scripts/import_dsc.py3
-rw-r--r--gbp/scripts/import_orig.py3
-rwxr-xr-xgbp/scripts/pq.py3
-rwxr-xr-xgbp/scripts/pull.py3
9 files changed, 22 insertions, 15 deletions
diff --git a/gbp/config.py b/gbp/config.py
index 9ac1ee8f..93961a20 100644
--- a/gbp/config.py
+++ b/gbp/config.py
@@ -20,7 +20,6 @@ from optparse import OptionParser, OptionGroup, Option, OptionValueError
from ConfigParser import SafeConfigParser, NoSectionError
from copy import copy
import os.path
-import sys
try:
from gbp.version import gbp_version
except ImportError:
@@ -357,7 +356,7 @@ class GbpOptionParser(OptionParser):
else:
self.config['filter'] = []
- def __init__(self, command=None, prefix='', usage=None, sections=[]):
+ def __init__(self, command, prefix='', usage=None, sections=[]):
"""
@param command: the command to build the config parser for
@type command: C{str}
@@ -369,18 +368,19 @@ class GbpOptionParser(OptionParser):
to parse
@type sections: C{list} of C{str}
"""
- if not command:
- command = os.path.basename(sys.argv[0])
- if command == 'gbp':
- command += " " + os.path.basename(sys.argv[1])
self.command = command
self.sections = sections
self.prefix = prefix
self.config = {}
self.config_files = self.get_config_files()
self._parse_config_files()
+
+ if self.command.startswith('git-') or self.command.startswith('gbp-'):
+ prog = self.command
+ else:
+ prog = "gbp %s" % self.command
OptionParser.__init__(self, option_class=GbpOption,
- prog=command,
+ prog=prog,
usage=usage, version='%s %s' % (self.command,
gbp_version))
diff --git a/gbp/scripts/buildpackage.py b/gbp/scripts/buildpackage.py
index 0b14b3f6..753ad64a 100755
--- a/gbp/scripts/buildpackage.py
+++ b/gbp/scripts/buildpackage.py
@@ -375,7 +375,7 @@ def parse_args(argv, prefix):
args.append(arg)
try:
- parser = GbpOptionParserDebian(prefix=prefix)
+ parser = GbpOptionParserDebian(command=os.path.basename(argv[0]), prefix=prefix)
except ConfigParser.ParsingError as err:
gbp.log.err(err)
return None, None, None
diff --git a/gbp/scripts/clone.py b/gbp/scripts/clone.py
index 1ddee3fb..251cef21 100755
--- a/gbp/scripts/clone.py
+++ b/gbp/scripts/clone.py
@@ -31,7 +31,8 @@ import gbp.log
def parse_args (argv):
try:
- parser = GbpOptionParser(usage='%prog [options] repository - clone a remote repository')
+ parser = GbpOptionParser(command=os.path.basename(argv[0]), prefix='',
+ usage='%prog [options] repository - clone a remote repository')
except ConfigParser.ParsingError as err:
gbp.log.err(err)
return None, None
diff --git a/gbp/scripts/create_remote_repo.py b/gbp/scripts/create_remote_repo.py
index 95a10b00..c8c4a36a 100644
--- a/gbp/scripts/create_remote_repo.py
+++ b/gbp/scripts/create_remote_repo.py
@@ -245,7 +245,8 @@ def parse_args(argv, sections=[]):
else:
sections = []
- parser = GbpOptionParserDebian(usage='%prog [options] - '
+ parser = GbpOptionParserDebian(command=os.path.basename(argv[0]), prefix='',
+ usage='%prog [options] - '
'create a remote repository',
sections=sections)
branch_group = GbpOptionGroup(parser,
diff --git a/gbp/scripts/dch.py b/gbp/scripts/dch.py
index 30c90d16..a848d6d2 100644
--- a/gbp/scripts/dch.py
+++ b/gbp/scripts/dch.py
@@ -292,7 +292,8 @@ def main(argv):
branch = None
try:
- parser = GbpOptionParserDebian(usage='%prog [options] paths')
+ parser = GbpOptionParserDebian(command=os.path.basename(argv[0]), prefix='',
+ usage='%prog [options] paths')
except ConfigParser.ParsingError as err:
gbp.log.err(err)
return 1
diff --git a/gbp/scripts/import_dsc.py b/gbp/scripts/import_dsc.py
index cbc67f0f..630422bf 100644
--- a/gbp/scripts/import_dsc.py
+++ b/gbp/scripts/import_dsc.py
@@ -207,7 +207,8 @@ def set_bare_repo_options(options):
def parse_args(argv):
try:
- parser = GbpOptionParserDebian(usage='%prog [options] /path/to/package.dsc')
+ parser = GbpOptionParserDebian(command=os.path.basename(argv[0]), prefix='',
+ usage='%prog [options] /path/to/package.dsc')
except ConfigParser.ParsingError as err:
gbp.log.err(err)
return None, None
diff --git a/gbp/scripts/import_orig.py b/gbp/scripts/import_orig.py
index 968aadb1..aae93fab 100644
--- a/gbp/scripts/import_orig.py
+++ b/gbp/scripts/import_orig.py
@@ -183,7 +183,8 @@ def set_bare_repo_options(options):
def parse_args(argv):
try:
- parser = GbpOptionParserDebian(usage='%prog [options] /path/to/upstream-version.tar.gz | --uscan')
+ parser = GbpOptionParserDebian(command=os.path.basename(argv[0]), prefix='',
+ usage='%prog [options] /path/to/upstream-version.tar.gz | --uscan')
except ConfigParser.ParsingError as err:
gbp.log.err(err)
return None, None
diff --git a/gbp/scripts/pq.py b/gbp/scripts/pq.py
index 5e941262..41d3ddf8 100755
--- a/gbp/scripts/pq.py
+++ b/gbp/scripts/pq.py
@@ -212,7 +212,8 @@ def switch_pq(repo, current):
def parse_args(argv):
try:
- parser = GbpOptionParserDebian(usage="%prog [options] action - maintain patches on a patch queue branch\n"
+ parser = GbpOptionParserDebian(command=os.path.basename(argv[0]), prefix='',
+ usage="%prog [options] action - maintain patches on a patch queue branch\n"
"Actions:\n"
" export export the patch queue associated to the current branch\n"
" into a quilt patch series in debian/patches/ and update the\n"
diff --git a/gbp/scripts/pull.py b/gbp/scripts/pull.py
index 6cc47d4c..03be9fc7 100755
--- a/gbp/scripts/pull.py
+++ b/gbp/scripts/pull.py
@@ -70,7 +70,8 @@ def fast_forward_branch(branch, repo, options):
def parse_args(argv):
try:
- parser = GbpOptionParser(usage='%prog [options] - safely update a repository from remote')
+ parser = GbpOptionParser(command=os.path.basename(argv[0]), prefix='',
+ usage='%prog [options] - safely update a repository from remote')
except ConfigParser.ParsingError as err:
gbp.log.err(err)
return None, None