Added test archive command.
This commit is contained in:
parent
c1ada5cc39
commit
2587bfda86
16
doc/patool.1
16
doc/patool.1
|
@ -15,9 +15,11 @@
|
||||||
.SH NAME
|
.SH NAME
|
||||||
patool - simple manager for file archives of various types
|
patool - simple manager for file archives of various types
|
||||||
.SH SYNOPSIS
|
.SH SYNOPSIS
|
||||||
\fBpatool\fP <\fIcommand\fP> [\fIoptions\fP] <\fIarchive-file\fP>
|
\fBpatool\fP (\fBextract\fP|\fBlist\fP|\fBtest\fP) [\fIoptions\fP] <\fIarchive-file\fP>
|
||||||
|
\fBpatool\fP \fBcreate\fP [\fIoptions\fP] <\fIarchive-file\fP> [\fIfiles..\fP]
|
||||||
|
\fBpatool\fP \fBformats\fP [\fIoptions\fP]
|
||||||
.SH DESCRIPTION
|
.SH DESCRIPTION
|
||||||
Various archive types can be created, extracted and listed by
|
Various archive types can be created, extracted, tested and listed by
|
||||||
\fBpatool\fP.
|
\fBpatool\fP.
|
||||||
The archive format is determined by the archive file extension and
|
The archive format is determined by the archive file extension and
|
||||||
as a fallback with file(1).
|
as a fallback with file(1).
|
||||||
|
@ -54,6 +56,14 @@ Verbose archive listing (if the helper application supports it).
|
||||||
.TP
|
.TP
|
||||||
\fB\-\-help\fP
|
\fB\-\-help\fP
|
||||||
Show help for this command.
|
Show help for this command.
|
||||||
|
.SS \fBtest\fP
|
||||||
|
Test files in an archive.
|
||||||
|
.TP
|
||||||
|
\fB\-\-verbose\fP
|
||||||
|
Verbose archive testing (if the helper application supports it).
|
||||||
|
.TP
|
||||||
|
\fB\-\-help\fP
|
||||||
|
Show help for this command.
|
||||||
.SS \fBformats\fP
|
.SS \fBformats\fP
|
||||||
Show all supported archive formats.
|
Show all supported archive formats.
|
||||||
.TP
|
.TP
|
||||||
|
@ -81,7 +91,7 @@ Supported archive formats are listed by the \fBformats\fP command.
|
||||||
.TP
|
.TP
|
||||||
\fImode\fP\fB=/usr/bin/mycommand\fP
|
\fImode\fP\fB=/usr/bin/mycommand\fP
|
||||||
Set the application to handle the archive format for given mode.
|
Set the application to handle the archive format for given mode.
|
||||||
\fImode\fP can be one of \fBextract\fP, \fBlist\fP.
|
\fImode\fP can be one of \fBextract\fP, \fBlist\fP, \fBtest\fP.
|
||||||
.SH FILES
|
.SH FILES
|
||||||
\fB/etc/patool.conf\fP, \fB~/.patool.conf\fP -
|
\fB/etc/patool.conf\fP, \fB~/.patool.conf\fP -
|
||||||
configuration files
|
configuration files
|
||||||
|
|
|
@ -6,10 +6,13 @@ NAME
|
||||||
patool - simple manager for file archives of various types
|
patool - simple manager for file archives of various types
|
||||||
|
|
||||||
SYNOPSIS
|
SYNOPSIS
|
||||||
patool <command> [options] <archive-file>
|
patool (extract|list|test) [options] <archive-file>
|
||||||
|
patool create [options] <archive-file> [files..]
|
||||||
|
patool formats [options]
|
||||||
|
|
||||||
DESCRIPTION
|
DESCRIPTION
|
||||||
Various archive types can be created, extracted and listed by patool. The archive format is determined by the archive file extension and as a fallback with file(1).
|
Various archive types can be created, extracted, tested and listed by patool. The archive format is determined by the archive file extension and as a fallback with
|
||||||
|
file(1).
|
||||||
|
|
||||||
patool supports 7z (.7z), ZIP (.zip, .jar), GZIP (.gz), compress (.Z), BZIP2 (.bz2), TAR (.tar), ARJ (.arj), CAB (.cab), CPIO (.cpio), RPM (.rpm), DEB (.deb), LZOP
|
patool supports 7z (.7z), ZIP (.zip, .jar), GZIP (.gz), compress (.Z), BZIP2 (.bz2), TAR (.tar), ARJ (.arj), CAB (.cab), CPIO (.cpio), RPM (.rpm), DEB (.deb), LZOP
|
||||||
(.lzo)and RAR (.rar) formats. It relies on helper applications to handle those archive formats (for example bzip2 for BZIP2 archives).
|
(.lzo)and RAR (.rar) formats. It relies on helper applications to handle those archive formats (for example bzip2 for BZIP2 archives).
|
||||||
|
@ -38,6 +41,14 @@ COMMANDS
|
||||||
|
|
||||||
--help Show help for this command.
|
--help Show help for this command.
|
||||||
|
|
||||||
|
test
|
||||||
|
Test files in an archive.
|
||||||
|
|
||||||
|
--verbose
|
||||||
|
Verbose archive testing (if the helper application supports it).
|
||||||
|
|
||||||
|
--help Show help for this command.
|
||||||
|
|
||||||
formats
|
formats
|
||||||
Show all supported archive formats.
|
Show all supported archive formats.
|
||||||
|
|
||||||
|
@ -61,7 +72,7 @@ CONFIGURATION
|
||||||
Supported archive formats are listed by the formats command.
|
Supported archive formats are listed by the formats command.
|
||||||
|
|
||||||
mode=/usr/bin/mycommand
|
mode=/usr/bin/mycommand
|
||||||
Set the application to handle the archive format for given mode. mode can be one of extract, list.
|
Set the application to handle the archive format for given mode. mode can be one of extract, list, test.
|
||||||
|
|
||||||
FILES
|
FILES
|
||||||
/etc/patool.conf, ~/.patool.conf - configuration files
|
/etc/patool.conf, ~/.patool.conf - configuration files
|
||||||
|
|
6
patool
6
patool
|
@ -35,6 +35,12 @@ def list (archive, verbose=False):
|
||||||
return patoolib.handle_archive(archive, 'list')
|
return patoolib.handle_archive(archive, 'list')
|
||||||
|
|
||||||
|
|
||||||
|
@patoolib.baker.command
|
||||||
|
def test (archive, verbose=False):
|
||||||
|
"""Test files in an archive."""
|
||||||
|
return patoolib.handle_archive(archive, 'test', verbose=verbose)
|
||||||
|
|
||||||
|
|
||||||
#@patoolib.baker.command
|
#@patoolib.baker.command
|
||||||
#def create (archive, *args):
|
#def create (archive, *args):
|
||||||
# """Create an archive from given files."""
|
# """Create an archive from given files."""
|
||||||
|
|
|
@ -19,7 +19,7 @@ from distutils.spawn import find_executable
|
||||||
from . import util, baker
|
from . import util, baker
|
||||||
|
|
||||||
# Supported archive commands
|
# Supported archive commands
|
||||||
ArchiveCommands = ('list', 'extract')
|
ArchiveCommands = ('list', 'extract', 'test')
|
||||||
|
|
||||||
# Supported archive formats
|
# Supported archive formats
|
||||||
ArchiveFormats = ('gzip', 'bzip2', 'tar', 'zip', 'compress', '7z', 'rar',
|
ArchiveFormats = ('gzip', 'bzip2', 'tar', 'zip', 'compress', '7z', 'rar',
|
||||||
|
@ -55,6 +55,7 @@ ArchiveMimetypes = {
|
||||||
ArchivePrograms = {
|
ArchivePrograms = {
|
||||||
'bzip2': {
|
'bzip2': {
|
||||||
'extract': ('pbzip2', 'bzip2', '7z'),
|
'extract': ('pbzip2', 'bzip2', '7z'),
|
||||||
|
'test': ('pbzip2', 'bzip2', '7z'),
|
||||||
'list': ('7z', 'echo',),
|
'list': ('7z', 'echo',),
|
||||||
},
|
},
|
||||||
'tar': {
|
'tar': {
|
||||||
|
@ -63,6 +64,7 @@ ArchivePrograms = {
|
||||||
'zip': {
|
'zip': {
|
||||||
'extract': ('unzip', '7z'),
|
'extract': ('unzip', '7z'),
|
||||||
'list': ('unzip', '7z'),
|
'list': ('unzip', '7z'),
|
||||||
|
'test': ('unzip', '7z'),
|
||||||
},
|
},
|
||||||
'gzip': {
|
'gzip': {
|
||||||
None: ('gzip', '7z'),
|
None: ('gzip', '7z'),
|
||||||
|
@ -70,6 +72,7 @@ ArchivePrograms = {
|
||||||
'compress': {
|
'compress': {
|
||||||
'extract': ('gzip', '7z', 'uncompress.real'),
|
'extract': ('gzip', '7z', 'uncompress.real'),
|
||||||
'list': ('7z', 'echo',),
|
'list': ('7z', 'echo',),
|
||||||
|
'test': ('gzip', '7z'),
|
||||||
},
|
},
|
||||||
'7z': {
|
'7z': {
|
||||||
None: ('7z',),
|
None: ('7z',),
|
||||||
|
@ -78,27 +81,33 @@ ArchivePrograms = {
|
||||||
None: ('rar',),
|
None: ('rar',),
|
||||||
'extract': ('unrar', '7z'),
|
'extract': ('unrar', '7z'),
|
||||||
'list': ('unrar', '7z'),
|
'list': ('unrar', '7z'),
|
||||||
|
'test': ('unrar', '7z'),
|
||||||
},
|
},
|
||||||
'cab': {
|
'cab': {
|
||||||
'extract': ('cabextract', '7z'),
|
'extract': ('cabextract', '7z'),
|
||||||
'list': ('cabextract', '7z'),
|
'list': ('cabextract', '7z'),
|
||||||
|
'test': ('cabextract', '7z'),
|
||||||
},
|
},
|
||||||
'arj': {
|
'arj': {
|
||||||
'extract': ('arj', '7z'),
|
'extract': ('arj', '7z'),
|
||||||
'list': ('arj', '7z'),
|
'list': ('arj', '7z'),
|
||||||
|
'test': ('arj', '7z'),
|
||||||
},
|
},
|
||||||
'cpio': {
|
'cpio': {
|
||||||
'extract': ('cpio', '7z'),
|
'extract': ('cpio', '7z'),
|
||||||
'list': ('cpio', '7z'),
|
'list': ('cpio', '7z'),
|
||||||
|
'test': ('7z',),
|
||||||
},
|
},
|
||||||
'rpm': {
|
'rpm': {
|
||||||
# XXX rpm2cpio depends on cpio which is not checked
|
# XXX rpm2cpio depends on cpio which is not checked
|
||||||
'extract': ('rpm2cpio', '7z'),
|
'extract': ('rpm2cpio', '7z'),
|
||||||
'list': ('rpm', '7z'),
|
'list': ('rpm', '7z'),
|
||||||
|
'test': ('rpm', '7z'),
|
||||||
},
|
},
|
||||||
'deb': {
|
'deb': {
|
||||||
'extract': ('dpkg-deb', '7z'),
|
'extract': ('dpkg-deb', '7z'),
|
||||||
'list': ('dpkg-deb', '7z'),
|
'list': ('dpkg-deb', '7z'),
|
||||||
|
'test': ('dpkg-deb', '7z'),
|
||||||
},
|
},
|
||||||
'lzop': {
|
'lzop': {
|
||||||
None: ('lzop',),
|
None: ('lzop',),
|
||||||
|
|
|
@ -21,8 +21,8 @@ def extract_arj (archive, encoding, cmd, **kwargs):
|
||||||
cmdlist.append('x')
|
cmdlist.append('x')
|
||||||
cmdlist.append('-r')
|
cmdlist.append('-r')
|
||||||
cmdlist.append('-y')
|
cmdlist.append('-y')
|
||||||
if kwargs['verbose']:
|
if not kwargs['verbose']:
|
||||||
cmdlist.append('-v')
|
cmdlist.append('-i-')
|
||||||
cmdlist.extend([archive, kwargs['outdir']])
|
cmdlist.extend([archive, kwargs['outdir']])
|
||||||
return cmdlist
|
return cmdlist
|
||||||
|
|
||||||
|
@ -33,6 +33,18 @@ def list_arj (archive, encoding, cmd, **kwargs):
|
||||||
cmdlist.append('v')
|
cmdlist.append('v')
|
||||||
else:
|
else:
|
||||||
cmdlist.append('l')
|
cmdlist.append('l')
|
||||||
|
cmdlist.append('-i-')
|
||||||
|
cmdlist.append('-r')
|
||||||
|
cmdlist.append('-y')
|
||||||
|
cmdlist.extend([archive])
|
||||||
|
return cmdlist
|
||||||
|
|
||||||
|
def test_arj (archive, encoding, cmd, **kwargs):
|
||||||
|
"""Test a ARJ archive."""
|
||||||
|
cmdlist = [cmd]
|
||||||
|
cmdlist.append('t')
|
||||||
|
if not kwargs['verbose']:
|
||||||
|
cmdlist.append('-i-')
|
||||||
cmdlist.append('-r')
|
cmdlist.append('-r')
|
||||||
cmdlist.append('-y')
|
cmdlist.append('-y')
|
||||||
cmdlist.extend([archive])
|
cmdlist.extend([archive])
|
||||||
|
|
|
@ -30,3 +30,12 @@ def extract_bzip2 (archive, encoding, cmd, **kwargs):
|
||||||
# note that for shell calls the command must be a string
|
# note that for shell calls the command must be a string
|
||||||
cmd = " ".join([util.shell_quote(x) for x in cmdlist])
|
cmd = " ".join([util.shell_quote(x) for x in cmdlist])
|
||||||
return (cmd, {'shell': True})
|
return (cmd, {'shell': True})
|
||||||
|
|
||||||
|
|
||||||
|
def test_bzip2 (archive, encoding, cmd, **kwargs):
|
||||||
|
cmdlist = [cmd]
|
||||||
|
if kwargs['verbose']:
|
||||||
|
cmdlist.append('-v')
|
||||||
|
cmdlist.extend(['-t', '--'])
|
||||||
|
cmdlist.extend([archive])
|
||||||
|
return cmdlist
|
||||||
|
|
|
@ -32,3 +32,10 @@ def list_cab (archive, encoding, cmd, **kwargs):
|
||||||
cmdlist.append('-v')
|
cmdlist.append('-v')
|
||||||
cmdlist.extend([archive])
|
cmdlist.extend([archive])
|
||||||
return cmdlist
|
return cmdlist
|
||||||
|
|
||||||
|
def test_cab (archive, encoding, cmd, **kwargs):
|
||||||
|
"""Test a CAB archive."""
|
||||||
|
cmdlist = [cmd]
|
||||||
|
cmdlist.append('-t')
|
||||||
|
cmdlist.extend([archive])
|
||||||
|
return cmdlist
|
||||||
|
|
|
@ -33,3 +33,6 @@ def list_deb (archive, encoding, cmd, **kwargs):
|
||||||
cmdlist.append('--')
|
cmdlist.append('--')
|
||||||
cmdlist.extend([archive])
|
cmdlist.extend([archive])
|
||||||
return cmdlist
|
return cmdlist
|
||||||
|
|
||||||
|
test_deb = list_deb
|
||||||
|
|
||||||
|
|
|
@ -43,3 +43,15 @@ def list_gzip (archive, encoding, cmd, **kwargs):
|
||||||
cmdlist.append(archive)
|
cmdlist.append(archive)
|
||||||
return cmdlist
|
return cmdlist
|
||||||
|
|
||||||
|
|
||||||
|
def test_gzip (archive, encoding, cmd, **kwargs):
|
||||||
|
"""Test a GZIP archive."""
|
||||||
|
cmdlist = [cmd]
|
||||||
|
if kwargs['verbose']:
|
||||||
|
cmdlist.append('-v')
|
||||||
|
cmdlist.append('-t')
|
||||||
|
cmdlist.append('--')
|
||||||
|
cmdlist.append(archive)
|
||||||
|
return cmdlist
|
||||||
|
|
||||||
|
test_compress = test_gzip
|
||||||
|
|
|
@ -32,3 +32,12 @@ def list_lzop (archive, encoding, cmd, **kwargs):
|
||||||
cmdlist.append('--verbose')
|
cmdlist.append('--verbose')
|
||||||
cmdlist.extend(['--', archive])
|
cmdlist.extend(['--', archive])
|
||||||
return cmdlist
|
return cmdlist
|
||||||
|
|
||||||
|
def test_lzop (archive, encoding, cmd, **kwargs):
|
||||||
|
"""Test a LZOP archive."""
|
||||||
|
cmdlist = [cmd]
|
||||||
|
cmdlist.append('--test')
|
||||||
|
if kwargs['verbose']:
|
||||||
|
cmdlist.append('--verbose')
|
||||||
|
cmdlist.extend(['--', archive])
|
||||||
|
return cmdlist
|
||||||
|
|
|
@ -59,3 +59,26 @@ list_bzip2 = \
|
||||||
list_rpm = \
|
list_rpm = \
|
||||||
list_deb = \
|
list_deb = \
|
||||||
list_7z
|
list_7z
|
||||||
|
|
||||||
|
|
||||||
|
def test_7z (archive, encoding, cmd, **kwargs):
|
||||||
|
"""Test a 7z archive."""
|
||||||
|
cmdlist = [cmd]
|
||||||
|
cmdlist.append('t')
|
||||||
|
if not kwargs['verbose']:
|
||||||
|
cmdlist.append('-bd')
|
||||||
|
cmdlist.append('--')
|
||||||
|
cmdlist.append(archive)
|
||||||
|
return cmdlist
|
||||||
|
|
||||||
|
test_bzip2 = \
|
||||||
|
test_gzip = \
|
||||||
|
test_zip = \
|
||||||
|
test_compress = \
|
||||||
|
test_rar = \
|
||||||
|
test_cab = \
|
||||||
|
test_arj = \
|
||||||
|
test_cpio = \
|
||||||
|
test_rpm = \
|
||||||
|
test_deb = \
|
||||||
|
test_7z
|
||||||
|
|
|
@ -15,4 +15,4 @@
|
||||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
"""Archive commands for the pbzip2 program."""
|
"""Archive commands for the pbzip2 program."""
|
||||||
# bzip2 and pbzip2 are compatible
|
# bzip2 and pbzip2 are compatible
|
||||||
from .bzip2 import extract_bzip2
|
from .bzip2 import extract_bzip2, test_bzip2
|
||||||
|
|
|
@ -34,3 +34,12 @@ def list_rar (archive, encoding, cmd, **kwargs):
|
||||||
cmdlist.append('-c-')
|
cmdlist.append('-c-')
|
||||||
cmdlist.extend(['--', archive])
|
cmdlist.extend(['--', archive])
|
||||||
return cmdlist
|
return cmdlist
|
||||||
|
|
||||||
|
def test_rar (archive, encoding, cmd, **kwargs):
|
||||||
|
"""Test a RAR archive."""
|
||||||
|
cmdlist = [cmd]
|
||||||
|
cmdlist.append('t')
|
||||||
|
if not kwargs['verbose']:
|
||||||
|
cmdlist.append('-c-')
|
||||||
|
cmdlist.extend(['--', archive])
|
||||||
|
return cmdlist
|
||||||
|
|
|
@ -23,3 +23,12 @@ def list_rpm (archive, encoding, cmd, **kwargs):
|
||||||
cmdlist.append('-v')
|
cmdlist.append('-v')
|
||||||
cmdlist.extend(['-p', '--', archive])
|
cmdlist.extend(['-p', '--', archive])
|
||||||
return cmdlist
|
return cmdlist
|
||||||
|
|
||||||
|
def test_rpm (archive, encoding, cmd, **kwargs):
|
||||||
|
"""Test a RPM archive."""
|
||||||
|
cmdlist = [cmd]
|
||||||
|
cmdlist.append('-V')
|
||||||
|
if kwargs['verbose']:
|
||||||
|
cmdlist.append('-v')
|
||||||
|
cmdlist.extend(['-p', '--', archive])
|
||||||
|
return cmdlist
|
||||||
|
|
|
@ -44,3 +44,5 @@ def list_tar (archive, encoding, cmd, **kwargs):
|
||||||
cmdlist.append('-v')
|
cmdlist.append('-v')
|
||||||
cmdlist.append("file=%s" % archive)
|
cmdlist.append("file=%s" % archive)
|
||||||
return cmdlist
|
return cmdlist
|
||||||
|
|
||||||
|
test_tar = list_tar
|
||||||
|
|
|
@ -34,3 +34,5 @@ def list_tar (archive, encoding, cmd, **kwargs):
|
||||||
cmdlist.append('--verbose')
|
cmdlist.append('--verbose')
|
||||||
cmdlist.extend(["--file", archive])
|
cmdlist.extend(["--file", archive])
|
||||||
return cmdlist
|
return cmdlist
|
||||||
|
|
||||||
|
test_tar = list_tar
|
||||||
|
|
|
@ -34,3 +34,12 @@ def list_rar (archive, encoding, cmd, **kwargs):
|
||||||
cmdlist.append('-c-')
|
cmdlist.append('-c-')
|
||||||
cmdlist.extend(['--', archive])
|
cmdlist.extend(['--', archive])
|
||||||
return cmdlist
|
return cmdlist
|
||||||
|
|
||||||
|
def test_rar (archive, encoding, cmd, **kwargs):
|
||||||
|
"""Test a RAR archive."""
|
||||||
|
cmdlist = [cmd]
|
||||||
|
cmdlist.append('t')
|
||||||
|
if not kwargs['verbose']:
|
||||||
|
cmdlist.append('-c-')
|
||||||
|
cmdlist.extend(['--', archive])
|
||||||
|
return cmdlist
|
||||||
|
|
|
@ -31,3 +31,12 @@ def list_zip (archive, encoding, cmd, **kwargs):
|
||||||
cmdlist.append('-v')
|
cmdlist.append('-v')
|
||||||
cmdlist.extend(['--', archive])
|
cmdlist.extend(['--', archive])
|
||||||
return cmdlist
|
return cmdlist
|
||||||
|
|
||||||
|
def test_zip (archive, encoding, cmd, **kwargs):
|
||||||
|
"""Test a ZIP archive."""
|
||||||
|
cmdlist = [cmd]
|
||||||
|
cmdlist.append('-t')
|
||||||
|
if kwargs['verbose']:
|
||||||
|
cmdlist.append('-v')
|
||||||
|
cmdlist.extend(['--', archive])
|
||||||
|
return cmdlist
|
||||||
|
|
|
@ -26,8 +26,9 @@ datadir = os.path.join(basedir, 'data')
|
||||||
class ArchiveTest (unittest.TestCase):
|
class ArchiveTest (unittest.TestCase):
|
||||||
"""Helper class for achive tests."""
|
"""Helper class for achive tests."""
|
||||||
|
|
||||||
def archive_test (self, filename, cmd):
|
def archive_commands (self, filename, cmd):
|
||||||
self.archive_list(filename, cmd)
|
self.archive_list(filename, cmd)
|
||||||
|
self.archive_test(filename, cmd)
|
||||||
self.archive_extract(filename, cmd)
|
self.archive_extract(filename, cmd)
|
||||||
|
|
||||||
def archive_extract (self, filename, cmd):
|
def archive_extract (self, filename, cmd):
|
||||||
|
@ -36,16 +37,21 @@ class ArchiveTest (unittest.TestCase):
|
||||||
tmpdir = patoolib.util.tmpdir(dir=basedir)
|
tmpdir = patoolib.util.tmpdir(dir=basedir)
|
||||||
os.chdir(tmpdir)
|
os.chdir(tmpdir)
|
||||||
try:
|
try:
|
||||||
patoolib._handle_archive(archive, 'extract', cmd=cmd)
|
patoolib._handle_archive(archive, 'extract', program=cmd)
|
||||||
patoolib._handle_archive(archive, 'extract', cmd=cmd, force=True)
|
patoolib._handle_archive(archive, 'extract', program=cmd, force=True)
|
||||||
finally:
|
finally:
|
||||||
os.chdir(basedir)
|
os.chdir(basedir)
|
||||||
shutil.rmtree(tmpdir)
|
shutil.rmtree(tmpdir)
|
||||||
|
|
||||||
def archive_list (self, filename, cmd):
|
def archive_list (self, filename, cmd):
|
||||||
archive = os.path.join(datadir, filename)
|
archive = os.path.join(datadir, filename)
|
||||||
patoolib._handle_archive(archive, 'list', cmd=cmd)
|
patoolib._handle_archive(archive, 'list', program=cmd)
|
||||||
patoolib._handle_archive(archive, 'list', cmd=cmd, verbose=True)
|
patoolib._handle_archive(archive, 'list', program=cmd, verbose=True)
|
||||||
|
|
||||||
|
def archive_test (self, filename, cmd):
|
||||||
|
archive = os.path.join(datadir, filename)
|
||||||
|
patoolib._handle_archive(archive, 'test', program=cmd)
|
||||||
|
patoolib._handle_archive(archive, 'test', program=cmd, verbose=True)
|
||||||
|
|
||||||
|
|
||||||
def needs_cmd (cmd):
|
def needs_cmd (cmd):
|
||||||
|
|
|
@ -26,19 +26,21 @@ class TestArchives (ArchiveTest):
|
||||||
self.tar_test('star')
|
self.tar_test('star')
|
||||||
|
|
||||||
def tar_test (self, cmd):
|
def tar_test (self, cmd):
|
||||||
self.archive_test('t.tar', cmd)
|
self.archive_commands('t.tar', cmd)
|
||||||
self.archive_test('t.tar.gz', cmd)
|
self.archive_commands('t.tar.gz', cmd)
|
||||||
self.archive_test('t.tar.Z', cmd)
|
self.archive_commands('t.tar.Z', cmd)
|
||||||
self.archive_test('t.tar.bz2', cmd)
|
self.archive_commands('t.tar.bz2', cmd)
|
||||||
self.archive_test('t.tbz2', cmd)
|
self.archive_commands('t.tbz2', cmd)
|
||||||
|
|
||||||
@needs_cmd('bzip2')
|
@needs_cmd('bzip2')
|
||||||
def test_bzip2 (self):
|
def test_bzip2 (self):
|
||||||
self.archive_extract('t.bz2', 'bzip2')
|
self.archive_extract('t.bz2', 'bzip2')
|
||||||
|
self.archive_test('t.bz2', 'bzip2')
|
||||||
|
|
||||||
@needs_cmd('pbzip2')
|
@needs_cmd('pbzip2')
|
||||||
def test_pbzip2 (self):
|
def test_pbzip2 (self):
|
||||||
self.archive_extract('t.bz2', 'pbzip2')
|
self.archive_extract('t.bz2', 'pbzip2')
|
||||||
|
self.archive_test('t.bz2', 'pbzip2')
|
||||||
|
|
||||||
@needs_cmd('echo')
|
@needs_cmd('echo')
|
||||||
def test_echo (self):
|
def test_echo (self):
|
||||||
|
@ -47,13 +49,13 @@ class TestArchives (ArchiveTest):
|
||||||
|
|
||||||
@needs_cmd('unzip')
|
@needs_cmd('unzip')
|
||||||
def test_unzip (self):
|
def test_unzip (self):
|
||||||
self.archive_test('t.zip', 'unzip')
|
self.archive_commands('t.zip', 'unzip')
|
||||||
self.archive_test('t.jar', 'unzip')
|
self.archive_commands('t.jar', 'unzip')
|
||||||
|
|
||||||
@needs_cmd('gzip')
|
@needs_cmd('gzip')
|
||||||
def test_gzip (self):
|
def test_gzip (self):
|
||||||
self.archive_test('t.gz', 'gzip')
|
self.archive_commands('t.gz', 'gzip')
|
||||||
self.archive_test('t.txt.gz', 'gzip')
|
self.archive_commands('t.txt.gz', 'gzip')
|
||||||
self.archive_extract('t.Z', 'gzip')
|
self.archive_extract('t.Z', 'gzip')
|
||||||
|
|
||||||
@needs_cmd('uncompress.real')
|
@needs_cmd('uncompress.real')
|
||||||
|
@ -62,7 +64,7 @@ class TestArchives (ArchiveTest):
|
||||||
|
|
||||||
@needs_cmd('7z')
|
@needs_cmd('7z')
|
||||||
def test_p7zip (self):
|
def test_p7zip (self):
|
||||||
self.archive_test('t.7z', '7z')
|
self.archive_commands('t.7z', '7z')
|
||||||
self.archive_list('t.gz', '7z')
|
self.archive_list('t.gz', '7z')
|
||||||
self.archive_list('t.bz2', '7z')
|
self.archive_list('t.bz2', '7z')
|
||||||
self.archive_list('t.zip', '7z')
|
self.archive_list('t.zip', '7z')
|
||||||
|
@ -85,6 +87,17 @@ class TestArchives (ArchiveTest):
|
||||||
self.archive_extract('t.cpio', '7z')
|
self.archive_extract('t.cpio', '7z')
|
||||||
self.archive_extract('t.rpm', '7z')
|
self.archive_extract('t.rpm', '7z')
|
||||||
self.archive_extract('t.deb', '7z')
|
self.archive_extract('t.deb', '7z')
|
||||||
|
self.archive_test('t.gz', '7z')
|
||||||
|
self.archive_test('t.bz2', '7z')
|
||||||
|
self.archive_test('t.zip', '7z')
|
||||||
|
self.archive_test('t.jar', '7z')
|
||||||
|
self.archive_test('t.Z', '7z')
|
||||||
|
self.archive_test('t.rar', '7z')
|
||||||
|
self.archive_test('t.cab', '7z')
|
||||||
|
self.archive_test('t.arj', '7z')
|
||||||
|
self.archive_test('t.cpio', '7z')
|
||||||
|
self.archive_test('t.rpm', '7z')
|
||||||
|
self.archive_test('t.deb', '7z')
|
||||||
|
|
||||||
@needs_cmd('unrar')
|
@needs_cmd('unrar')
|
||||||
def test_unrar (self):
|
def test_unrar (self):
|
||||||
|
@ -93,7 +106,7 @@ class TestArchives (ArchiveTest):
|
||||||
|
|
||||||
@needs_cmd('rar')
|
@needs_cmd('rar')
|
||||||
def test_rar (self):
|
def test_rar (self):
|
||||||
self.archive_test('t.rar', 'rar')
|
self.archive_commands('t.rar', 'rar')
|
||||||
|
|
||||||
@needs_cmd('cabextract')
|
@needs_cmd('cabextract')
|
||||||
def test_capextract (self):
|
def test_capextract (self):
|
||||||
|
@ -103,6 +116,7 @@ class TestArchives (ArchiveTest):
|
||||||
@needs_cmd('arj')
|
@needs_cmd('arj')
|
||||||
def test_arj (self):
|
def test_arj (self):
|
||||||
self.archive_list('t.arj', 'arj')
|
self.archive_list('t.arj', 'arj')
|
||||||
|
self.archive_test('t.arj', 'arj')
|
||||||
self.archive_extract('t.arj', 'arj')
|
self.archive_extract('t.arj', 'arj')
|
||||||
|
|
||||||
@needs_cmd('cpio')
|
@needs_cmd('cpio')
|
||||||
|
@ -113,6 +127,8 @@ class TestArchives (ArchiveTest):
|
||||||
@needs_cmd('rpm')
|
@needs_cmd('rpm')
|
||||||
def test_rpm (self):
|
def test_rpm (self):
|
||||||
self.archive_list('t.rpm', 'rpm')
|
self.archive_list('t.rpm', 'rpm')
|
||||||
|
# the rpm test fails on non-rpm system with missing dependencies
|
||||||
|
#self.archive_test('t.rpm', 'rpm')
|
||||||
|
|
||||||
@needs_cmd('rpm2cpio')
|
@needs_cmd('rpm2cpio')
|
||||||
@needs_cmd('cpio')
|
@needs_cmd('cpio')
|
||||||
|
@ -123,8 +139,9 @@ class TestArchives (ArchiveTest):
|
||||||
def test_dpkg (self):
|
def test_dpkg (self):
|
||||||
self.archive_list('t.deb', 'dpkg')
|
self.archive_list('t.deb', 'dpkg')
|
||||||
self.archive_extract('t.deb', 'dpkg')
|
self.archive_extract('t.deb', 'dpkg')
|
||||||
|
self.archive_test('t.deb', 'dpkg')
|
||||||
|
|
||||||
@needs_cmd('lzop')
|
@needs_cmd('lzop')
|
||||||
def test_lzop (self):
|
def test_lzop (self):
|
||||||
self.archive_test('t.lzo', 'lzop')
|
self.archive_commands('t.lzo', 'lzop')
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue