aboutsummaryrefslogtreecommitdiff
path: root/gbp/scripts/import_dsc.py
diff options
context:
space:
mode:
authorGuido G√ľnther <agx@sigxcpu.org>2016-12-04 19:35:28 +0100
committerGuido G√ľnther <agx@sigxcpu.org>2016-12-04 19:45:57 +0100
commitf631e64845e1d6584b94dd18da2b5e91d4c71d67 (patch)
tree36fe093396719b40bb3bd97468c3980fb0cac32b /gbp/scripts/import_dsc.py
parent0a9cf44593fbb97bdbd6cfdcdfb37de69f4b9c90 (diff)
import_dsc: fail properly again without a package to import
(introduced by 03276df5b9391dc877521cd6c3553ca071157991)
Diffstat (limited to 'gbp/scripts/import_dsc.py')
-rw-r--r--gbp/scripts/import_dsc.py13
1 files changed, 9 insertions, 4 deletions
diff --git a/gbp/scripts/import_dsc.py b/gbp/scripts/import_dsc.py
index 130ed70..6113032 100644
--- a/gbp/scripts/import_dsc.py
+++ b/gbp/scripts/import_dsc.py
@@ -216,7 +216,7 @@ def disable_pristine_tar(options, reason):
def build_parser(name):
try:
parser = GbpOptionParserDebian(command=os.path.basename(name), prefix='',
- usage='%prog [options] /path/to/package.dsc [<target>]')
+ usage='%prog [options] /path/to/package.dsc [target]')
except GbpError as err:
gbp.log.err(err)
return None
@@ -293,7 +293,13 @@ def main(argv):
return ExitCodes.parse_error
try:
- if len(args) > 2:
+ if len(args) == 1:
+ pkg = args[0]
+ target = None
+ elif len(args) == 2:
+ pkg = args[0]
+ target = args[1]
+ else:
gbp.log.err("Need to give exactly one package to import. Try --help.")
raise GbpError
try:
@@ -309,7 +315,6 @@ def main(argv):
needs_repo = True
is_empty = True
- pkg = args[0]
if options.download:
dsc = download_source(pkg,
dirs=dirs,
@@ -324,7 +329,7 @@ def main(argv):
print_dsc(src)
if needs_repo:
- target = args[1] if len(args) >= 2 else src.pkg
+ target = target or src.pkg
if os.path.exists(target):
raise GbpError("Directory '%s' already exists. If you want to import into it, "
"please change into this directory otherwise move it away first."