From b341a83cde54b0cbb6f6bc226c495c6d92718b46 Mon Sep 17 00:00:00 2001 From: Bastian Kleineidam Date: Sun, 18 Nov 2012 20:43:04 +0100 Subject: [PATCH] Add zip test command. --- patoolib/__init__.py | 2 +- patoolib/programs/zip.py | 8 ++++++++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/patoolib/__init__.py b/patoolib/__init__.py index aaff053..8eb8c7b 100644 --- a/patoolib/__init__.py +++ b/patoolib/__init__.py @@ -136,7 +136,7 @@ ArchivePrograms = { None: ('7z', '7za', 'py_zipfile'), 'extract': ('unzip',), 'list': ('unzip',), - 'test': ('unzip',), + 'test': ('zip', 'unzip',), 'create': ('zip',), }, 'gzip': { diff --git a/patoolib/programs/zip.py b/patoolib/programs/zip.py index fbbaadf..0f386a9 100644 --- a/patoolib/programs/zip.py +++ b/patoolib/programs/zip.py @@ -23,3 +23,11 @@ def create_zip (archive, compression, cmd, *args, **kwargs): cmdlist.append(archive) cmdlist.extend(args) return cmdlist + +def test_zip (archive, compression, cmd, *args, **kwargs): + """Test a ZIP archive.""" + cmdlist = [cmd, '--test'] + if kwargs['verbose']: + cmdlist.append('-v') + cmdlist.append(archive) + return cmdlist