Print error when archive files do not exist.
This commit is contained in:
parent
81ab40ab45
commit
37f0daf18f
|
@ -1,6 +1,7 @@
|
|||
0.15 "" (released xx.xx.2012)
|
||||
|
||||
* Print help when unknown options are given.
|
||||
* Print error when archive files do not exist.
|
||||
|
||||
0.14 "Book of Dragons" (released 30.1.2012)
|
||||
|
||||
|
|
13
patool
13
patool
|
@ -33,16 +33,16 @@ shortopts = {"verbose": "v"}
|
|||
def handle_multi_archive(archives, cmd, **kwargs):
|
||||
"""Handle a multi-archive command."""
|
||||
res = 0
|
||||
archives = [x for x in archives if os.path.exists(x)]
|
||||
if archives:
|
||||
for archive in archives:
|
||||
if not os.path.isfile(archive):
|
||||
res = 1
|
||||
msg = "archive %r is not a file" % archive
|
||||
print >>sys.stderr, "patool error:", msg
|
||||
else:
|
||||
newres = handle_archive(archive, cmd, **kwargs)
|
||||
# return error if one of the archives could not be extracted
|
||||
if newres:
|
||||
res = newres
|
||||
else:
|
||||
print >>sys.stderr, "patool error: none of the given archive files exist"
|
||||
res = 1
|
||||
return res
|
||||
|
||||
|
||||
|
@ -70,16 +70,19 @@ def create (archive, file1, *files, **kwargs):
|
|||
allfiles = (file1,)+files
|
||||
return handle_archive(archive, 'create', *allfiles, **kwargs)
|
||||
|
||||
|
||||
@baker.command
|
||||
def diff (archive1, archive2):
|
||||
"""Show differences between two archives."""
|
||||
return handle_archive(archive1, "diff", archive2)
|
||||
|
||||
|
||||
@baker.command
|
||||
def repack (archive1, archive2):
|
||||
"""Repackage one archive in another format."""
|
||||
return handle_archive(archive1, "repack", archive2)
|
||||
|
||||
|
||||
@baker.command
|
||||
def formats ():
|
||||
"""List supported and available archive formats."""
|
||||
|
|
Loading…
Reference in New Issue