summaryrefslogtreecommitdiff
path: root/git-import-orig
diff options
context:
space:
mode:
authorGuido Günther <agx@sigxcpu.org>2011-02-06 17:36:14 +0100
committerGuido Günther <agx@sigxcpu.org>2011-02-09 20:31:12 +0100
commit0212ccfbfcee55d61058cbe57e69f44510c39b6a (patch)
treee1689f4440604cbc59d8d1f086551b7a444f7598 /git-import-orig
parent14fdbce0a71f867d3809f3cf30b836ae57a7c7a4 (diff)
downloadgit-buildpackage-0212ccfbfcee55d61058cbe57e69f44510c39b6a.tar.gz
git-buildpackage-0212ccfbfcee55d61058cbe57e69f44510c39b6a.tar.bz2
git-buildpackage-0212ccfbfcee55d61058cbe57e69f44510c39b6a.zip
Split out command line parsing
to honor pycheckers sensible request for smaller functions. Git-Dch: Ignore
Diffstat (limited to 'git-import-orig')
-rwxr-xr-xgit-import-orig17
1 files changed, 11 insertions, 6 deletions
diff --git a/git-import-orig b/git-import-orig
index c735783b..391c5ee0 100755
--- a/git-import-orig
+++ b/git-import-orig
@@ -175,17 +175,14 @@ def ask_package_version(default):
# bit clearer.
gbp.log.warn("\nNot a valid upstream version: '%s'.\n%s" % (version, upstreamversion_msg))
-def main(argv):
- ret = 0
- tmpdir = ''
- pristine_orig = None
+def parse_args(argv):
try:
parser = GbpOptionParser(command=os.path.basename(argv[0]), prefix='',
usage='%prog [options] /path/to/upstream-version.tar.gz | --uscan')
except ConfigParser.ParsingError, err:
gbp.log.err(err)
- return 1
+ return None, None
import_group = GbpOptionGroup(parser, "import options",
"pristine-tar and filtering")
@@ -248,7 +245,15 @@ def main(argv):
if options.filters:
turn_off_fastimport(options, "Import filters currently not supported with fastimport.")
+ return options, args
+
+
+def main(argv):
+ ret = 0
+ tmpdir = ''
+ pristine_orig = None
+ (options, args) = parse_args(argv)
try:
if options.uscan: # uscan mode
@@ -272,7 +277,7 @@ def main(argv):
# tarball specified
if len(args) != 1:
- parser.print_help()
+ gbp.log.err("More than one tarball specified. Try --help.")
raise GbpError
else:
archive = args[0]