Rename encoding to compression in the context of archive handling. Makes more sense.
This commit is contained in:
parent
3fd52ed508
commit
79a376ce4e
|
@ -26,9 +26,9 @@ ArchiveFormats = ('7z', 'ace', 'alzip', 'ar', 'arc', 'arj', 'bzip2',
|
||||||
'cab', 'compress', 'cpio', 'deb', 'dms', 'gzip', 'lrzip', 'lzh', 'lzip', 'lzma',
|
'cab', 'compress', 'cpio', 'deb', 'dms', 'gzip', 'lrzip', 'lzh', 'lzip', 'lzma',
|
||||||
'lzop', 'rar', 'rpm', 'rzip', 'tar', 'xz', 'zip', 'zoo')
|
'lzop', 'rar', 'rpm', 'rzip', 'tar', 'xz', 'zip', 'zoo')
|
||||||
|
|
||||||
# Supported encodings (used with tar for example)
|
# Supported compressions (used with tar for example)
|
||||||
# Note that all encodings must also be archive formats
|
# Note that all compressions must also be archive formats
|
||||||
ArchiveEncodings = ('bzip2', 'compress', 'gzip', 'lzip', 'lzma', 'xz')
|
ArchiveCompressions = ('bzip2', 'compress', 'gzip', 'lzip', 'lzma', 'xz')
|
||||||
|
|
||||||
# Map MIME types to archive format
|
# Map MIME types to archive format
|
||||||
ArchiveMimetypes = {
|
ArchiveMimetypes = {
|
||||||
|
@ -65,9 +65,9 @@ ArchiveMimetypes = {
|
||||||
'application/x-dms': 'dms',
|
'application/x-dms': 'dms',
|
||||||
}
|
}
|
||||||
|
|
||||||
# List of programs supporting the given encoding
|
# List of programs supporting the given compression
|
||||||
|
|
||||||
EncodingPrograms = {
|
CompressionPrograms = {
|
||||||
'gzip': ('pigz', 'gzip'),
|
'gzip': ('pigz', 'gzip'),
|
||||||
'bzip2': ('pbzip2', 'lbzip2', 'bzip2'),
|
'bzip2': ('pbzip2', 'lbzip2', 'bzip2'),
|
||||||
'compress': ('compress',),
|
'compress': ('compress',),
|
||||||
|
@ -215,26 +215,26 @@ ProgramModules = {
|
||||||
|
|
||||||
|
|
||||||
def get_archive_format (filename):
|
def get_archive_format (filename):
|
||||||
"""Detect filename archive format and optional encoding."""
|
"""Detect filename archive format and optional compression."""
|
||||||
mime, encoding = util.guess_mime(filename)
|
mime, compression = util.guess_mime(filename)
|
||||||
if not (mime or encoding):
|
if not (mime or compression):
|
||||||
raise util.PatoolError("unknown archive format for file `%s'" % filename)
|
raise util.PatoolError("unknown archive format for file `%s'" % filename)
|
||||||
if mime in ArchiveMimetypes:
|
if mime in ArchiveMimetypes:
|
||||||
format = ArchiveMimetypes[mime]
|
format = ArchiveMimetypes[mime]
|
||||||
else:
|
else:
|
||||||
raise util.PatoolError("unknown archive format for file `%s' (mime-type is `%s')" % (filename, mime))
|
raise util.PatoolError("unknown archive format for file `%s' (mime-type is `%s')" % (filename, mime))
|
||||||
if format == encoding:
|
if format == compression:
|
||||||
# file cannot be in same format encoded
|
# file cannot be in same format compressed
|
||||||
encoding = None
|
compression = None
|
||||||
return format, encoding
|
return format, compression
|
||||||
|
|
||||||
|
|
||||||
def check_archive_format (format, encoding):
|
def check_archive_format (format, compression):
|
||||||
"""Make sure format and encoding is known."""
|
"""Make sure format and compression is known."""
|
||||||
if format not in ArchiveFormats:
|
if format not in ArchiveFormats:
|
||||||
raise util.PatoolError("unknown archive format `%s'" % format)
|
raise util.PatoolError("unknown archive format `%s'" % format)
|
||||||
if encoding is not None and encoding not in ArchiveEncodings:
|
if compression is not None and compression not in ArchiveCompressions:
|
||||||
raise util.PatoolError("unkonwn archive encoding `%s'" % encoding)
|
raise util.PatoolError("unkonwn archive compression `%s'" % compression)
|
||||||
|
|
||||||
|
|
||||||
def check_archive_command (command):
|
def check_archive_command (command):
|
||||||
|
@ -264,16 +264,16 @@ def find_archive_program (format, command):
|
||||||
raise util.PatoolError("could not find an executable program to %s format %s; candidates are (%s)," % (command, format, ",".join(programs)))
|
raise util.PatoolError("could not find an executable program to %s format %s; candidates are (%s)," % (command, format, ",".join(programs)))
|
||||||
|
|
||||||
|
|
||||||
def find_encoding_program (program, encoding):
|
def find_compression_program (program, compression):
|
||||||
"""Find suitable encoding program and return it. Returns None if
|
"""Find suitable compression program and return it. Returns None if
|
||||||
no encoding program could be found"""
|
no compression program could be found"""
|
||||||
if program in ('tar', 'star'):
|
if program in ('tar', 'star'):
|
||||||
for enc_program in EncodingPrograms[encoding]:
|
for enc_program in CompressionPrograms[compression]:
|
||||||
found = util.find_program(enc_program)
|
found = util.find_program(enc_program)
|
||||||
if found:
|
if found:
|
||||||
return found
|
return found
|
||||||
elif program == 'pytarfile':
|
elif program == 'pytarfile':
|
||||||
return encoding in ('gzip', 'bzip2')
|
return compression in ('gzip', 'bzip2')
|
||||||
return None
|
return None
|
||||||
|
|
||||||
|
|
||||||
|
@ -290,9 +290,9 @@ def list_formats ():
|
||||||
program = find_archive_program(format, command)
|
program = find_archive_program(format, command)
|
||||||
print " %8s: %s" % (command, program),
|
print " %8s: %s" % (command, program),
|
||||||
if format == 'tar':
|
if format == 'tar':
|
||||||
encs = [x for x in ArchiveEncodings if util.find_program(x)]
|
encs = [x for x in ArchiveCompressions if util.find_program(x)]
|
||||||
if encs:
|
if encs:
|
||||||
print "(supported encodings: %s)" % ", ".join(encs),
|
print "(supported compressions: %s)" % ", ".join(encs),
|
||||||
elif format == '7z':
|
elif format == '7z':
|
||||||
if util.p7zip_supports_rar():
|
if util.p7zip_supports_rar():
|
||||||
print "(rar archives supported)",
|
print "(rar archives supported)",
|
||||||
|
@ -317,10 +317,10 @@ def clean_config_keys (kwargs):
|
||||||
return config_kwargs
|
return config_kwargs
|
||||||
|
|
||||||
|
|
||||||
def parse_config (archive, format, encoding, command, **kwargs):
|
def parse_config (archive, format, compression, command, **kwargs):
|
||||||
"""The configuration determines which program to use for which
|
"""The configuration determines which program to use for which
|
||||||
archive format for the given command.
|
archive format for the given command.
|
||||||
@raises: PatoolError if command for given format and encoding
|
@raises: PatoolError if command for given format and compression
|
||||||
is not supported.
|
is not supported.
|
||||||
"""
|
"""
|
||||||
config = {
|
config = {
|
||||||
|
@ -335,9 +335,9 @@ def parse_config (archive, format, encoding, command, **kwargs):
|
||||||
value = program
|
value = program
|
||||||
config[key] = value
|
config[key] = value
|
||||||
program = os.path.basename(config['program'])
|
program = os.path.basename(config['program'])
|
||||||
if encoding and not find_encoding_program(program, encoding):
|
if compression and not find_compression_program(program, compression):
|
||||||
msg = "cannot %s archive `%s': encoding `%s' not supported by %s" % \
|
msg = "cannot %s archive `%s': compression `%s' not supported by %s" % \
|
||||||
(command, archive, encoding, program)
|
(command, archive, compression, program)
|
||||||
raise util.PatoolError(msg)
|
raise util.PatoolError(msg)
|
||||||
return config
|
return config
|
||||||
|
|
||||||
|
@ -427,13 +427,13 @@ def check_archive_arguments (archive, command, *args):
|
||||||
def _handle_archive (archive, command, *args, **kwargs):
|
def _handle_archive (archive, command, *args, **kwargs):
|
||||||
"""Handle archive command; raising PatoolError on errors."""
|
"""Handle archive command; raising PatoolError on errors."""
|
||||||
check_archive_arguments(archive, command, *args)
|
check_archive_arguments(archive, command, *args)
|
||||||
format, encoding = kwargs.get("format"), kwargs.get("encoding")
|
format, compression = kwargs.get("format"), kwargs.get("compression")
|
||||||
if format is None:
|
if format is None:
|
||||||
format, encoding = get_archive_format(archive)
|
format, compression = get_archive_format(archive)
|
||||||
check_archive_format(format, encoding)
|
check_archive_format(format, compression)
|
||||||
check_archive_command(command)
|
check_archive_command(command)
|
||||||
config_kwargs = clean_config_keys(kwargs)
|
config_kwargs = clean_config_keys(kwargs)
|
||||||
config = parse_config(archive, format, encoding, command, **config_kwargs)
|
config = parse_config(archive, format, compression, command, **config_kwargs)
|
||||||
# check if archive already exists
|
# check if archive already exists
|
||||||
if command == 'create' and os.path.exists(archive):
|
if command == 'create' and os.path.exists(archive):
|
||||||
raise util.PatoolError("archive `%s' already exists" % archive)
|
raise util.PatoolError("archive `%s' already exists" % archive)
|
||||||
|
@ -455,7 +455,7 @@ def _handle_archive (archive, command, *args, **kwargs):
|
||||||
origarchive = archive
|
origarchive = archive
|
||||||
archive = util.tmpfile(dir=os.path.dirname(archive), suffix=".arc")
|
archive = util.tmpfile(dir=os.path.dirname(archive), suffix=".arc")
|
||||||
try:
|
try:
|
||||||
cmdlist = get_archive_cmdlist(archive, encoding, program, *args, **cmd_kwargs)
|
cmdlist = get_archive_cmdlist(archive, compression, program, *args, **cmd_kwargs)
|
||||||
if cmdlist:
|
if cmdlist:
|
||||||
# an empty command list means the get_archive_cmdlist() function
|
# an empty command list means the get_archive_cmdlist() function
|
||||||
# already handled the command (eg. when it's a builting Python
|
# already handled the command (eg. when it's a builting Python
|
||||||
|
|
|
@ -15,7 +15,7 @@
|
||||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
from patoolib import util
|
from patoolib import util
|
||||||
|
|
||||||
def extract_singlefile_standard (archive, encoding, cmd, **kwargs):
|
def extract_singlefile_standard (archive, compression, cmd, **kwargs):
|
||||||
"""Standard routine to extract a singlefile archive (like gzip)."""
|
"""Standard routine to extract a singlefile archive (like gzip)."""
|
||||||
cmdlist = [util.shell_quote(cmd)]
|
cmdlist = [util.shell_quote(cmd)]
|
||||||
if kwargs['verbose']:
|
if kwargs['verbose']:
|
||||||
|
@ -26,7 +26,7 @@ def extract_singlefile_standard (archive, encoding, cmd, **kwargs):
|
||||||
return (cmdlist, {'shell': True})
|
return (cmdlist, {'shell': True})
|
||||||
|
|
||||||
|
|
||||||
def test_singlefile_standard (archive, encoding, cmd, **kwargs):
|
def test_singlefile_standard (archive, compression, cmd, **kwargs):
|
||||||
"""Standard routine to test a singlefile archive (like gzip)."""
|
"""Standard routine to test a singlefile archive (like gzip)."""
|
||||||
cmdlist = [cmd]
|
cmdlist = [cmd]
|
||||||
if kwargs['verbose']:
|
if kwargs['verbose']:
|
||||||
|
@ -35,7 +35,7 @@ def test_singlefile_standard (archive, encoding, cmd, **kwargs):
|
||||||
return cmdlist
|
return cmdlist
|
||||||
|
|
||||||
|
|
||||||
def create_singlefile_standard (archive, encoding, cmd, *args, **kwargs):
|
def create_singlefile_standard (archive, compression, cmd, *args, **kwargs):
|
||||||
"""Standard routine to create a singlefile archive (like gzip)."""
|
"""Standard routine to create a singlefile archive (like gzip)."""
|
||||||
cmdlist = [util.shell_quote(cmd)]
|
cmdlist = [util.shell_quote(cmd)]
|
||||||
if kwargs['verbose']:
|
if kwargs['verbose']:
|
||||||
|
|
|
@ -15,14 +15,14 @@
|
||||||
# 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 ar program."""
|
"""Archive commands for the ar program."""
|
||||||
|
|
||||||
def extract_ar (archive, encoding, cmd, **kwargs):
|
def extract_ar (archive, compression, cmd, **kwargs):
|
||||||
"""Extract a AR archive."""
|
"""Extract a AR archive."""
|
||||||
opts = 'x'
|
opts = 'x'
|
||||||
if kwargs['verbose']:
|
if kwargs['verbose']:
|
||||||
opts += 'v'
|
opts += 'v'
|
||||||
return [cmd, opts, archive, kwargs['outdir']]
|
return [cmd, opts, archive, kwargs['outdir']]
|
||||||
|
|
||||||
def list_ar (archive, encoding, cmd, **kwargs):
|
def list_ar (archive, compression, cmd, **kwargs):
|
||||||
"""List a AR archive."""
|
"""List a AR archive."""
|
||||||
opts = 't'
|
opts = 't'
|
||||||
if kwargs['verbose']:
|
if kwargs['verbose']:
|
||||||
|
@ -31,7 +31,7 @@ def list_ar (archive, encoding, cmd, **kwargs):
|
||||||
|
|
||||||
test_ar = list_ar
|
test_ar = list_ar
|
||||||
|
|
||||||
def create_ar (archive, encoding, cmd, *args, **kwargs):
|
def create_ar (archive, compression, cmd, *args, **kwargs):
|
||||||
"""Create a AR archive."""
|
"""Create a AR archive."""
|
||||||
opts = 'rc'
|
opts = 'rc'
|
||||||
if kwargs['verbose']:
|
if kwargs['verbose']:
|
||||||
|
|
|
@ -16,14 +16,14 @@
|
||||||
"""Archive commands for the arc program."""
|
"""Archive commands for the arc program."""
|
||||||
import os
|
import os
|
||||||
|
|
||||||
def extract_arc (archive, encoding, cmd, **kwargs):
|
def extract_arc (archive, compression, cmd, **kwargs):
|
||||||
"""Extract a ARC archive."""
|
"""Extract a ARC archive."""
|
||||||
# Since extracted files will be placed in the current directory,
|
# Since extracted files will be placed in the current directory,
|
||||||
# the cwd argument has to be the output directory.
|
# the cwd argument has to be the output directory.
|
||||||
cmdlist = [cmd, 'x', os.path.abspath(archive)]
|
cmdlist = [cmd, 'x', os.path.abspath(archive)]
|
||||||
return (cmdlist, {'cwd': kwargs['outdir']})
|
return (cmdlist, {'cwd': kwargs['outdir']})
|
||||||
|
|
||||||
def list_arc (archive, encoding, cmd, **kwargs):
|
def list_arc (archive, compression, cmd, **kwargs):
|
||||||
"""List a ARC archive."""
|
"""List a ARC archive."""
|
||||||
cmdlist = [cmd]
|
cmdlist = [cmd]
|
||||||
if kwargs['verbose']:
|
if kwargs['verbose']:
|
||||||
|
@ -33,11 +33,11 @@ def list_arc (archive, encoding, cmd, **kwargs):
|
||||||
cmdlist.append(archive)
|
cmdlist.append(archive)
|
||||||
return cmdlist
|
return cmdlist
|
||||||
|
|
||||||
def test_arc (archive, encoding, cmd, **kwargs):
|
def test_arc (archive, compression, cmd, **kwargs):
|
||||||
"""Test a ARC archive."""
|
"""Test a ARC archive."""
|
||||||
return [cmd, 't', archive]
|
return [cmd, 't', archive]
|
||||||
|
|
||||||
def create_arc (archive, encoding, cmd, *args, **kwargs):
|
def create_arc (archive, compression, cmd, *args, **kwargs):
|
||||||
"""Create a ARC archive."""
|
"""Create a ARC archive."""
|
||||||
cmdlist = [cmd, 'a', archive]
|
cmdlist = [cmd, 'a', archive]
|
||||||
cmdlist.extend(args)
|
cmdlist.extend(args)
|
||||||
|
|
|
@ -15,7 +15,7 @@
|
||||||
# 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 arj program."""
|
"""Archive commands for the arj program."""
|
||||||
|
|
||||||
def extract_arj (archive, encoding, cmd, **kwargs):
|
def extract_arj (archive, compression, cmd, **kwargs):
|
||||||
"""Extract a ARJ archive."""
|
"""Extract a ARJ archive."""
|
||||||
cmdlist = [cmd, 'x', '-r', '-y']
|
cmdlist = [cmd, 'x', '-r', '-y']
|
||||||
if not kwargs['verbose']:
|
if not kwargs['verbose']:
|
||||||
|
@ -24,7 +24,7 @@ def extract_arj (archive, encoding, cmd, **kwargs):
|
||||||
return cmdlist
|
return cmdlist
|
||||||
|
|
||||||
|
|
||||||
def list_arj (archive, encoding, cmd, **kwargs):
|
def list_arj (archive, compression, cmd, **kwargs):
|
||||||
"""List a ARJ archive."""
|
"""List a ARJ archive."""
|
||||||
cmdlist = [cmd]
|
cmdlist = [cmd]
|
||||||
if kwargs['verbose']:
|
if kwargs['verbose']:
|
||||||
|
@ -36,7 +36,7 @@ def list_arj (archive, encoding, cmd, **kwargs):
|
||||||
return cmdlist
|
return cmdlist
|
||||||
|
|
||||||
|
|
||||||
def test_arj (archive, encoding, cmd, **kwargs):
|
def test_arj (archive, compression, cmd, **kwargs):
|
||||||
"""Test a ARJ archive."""
|
"""Test a ARJ archive."""
|
||||||
cmdlist = [cmd, 't']
|
cmdlist = [cmd, 't']
|
||||||
if not kwargs['verbose']:
|
if not kwargs['verbose']:
|
||||||
|
@ -45,7 +45,7 @@ def test_arj (archive, encoding, cmd, **kwargs):
|
||||||
return cmdlist
|
return cmdlist
|
||||||
|
|
||||||
|
|
||||||
def create_arj (archive, encoding, cmd, *args, **kwargs):
|
def create_arj (archive, compression, cmd, *args, **kwargs):
|
||||||
"""Create a ARJ archive."""
|
"""Create a ARJ archive."""
|
||||||
cmdlist = [cmd, 'a', '-r', '-y']
|
cmdlist = [cmd, 'a', '-r', '-y']
|
||||||
if not kwargs['verbose']:
|
if not kwargs['verbose']:
|
||||||
|
|
|
@ -21,7 +21,7 @@ from patoolib.programs import extract_singlefile_standard, \
|
||||||
extract_bzip2 = extract_singlefile_standard
|
extract_bzip2 = extract_singlefile_standard
|
||||||
test_bzip2 = test_singlefile_standard
|
test_bzip2 = test_singlefile_standard
|
||||||
|
|
||||||
def create_bzip2 (archive, encoding, cmd, *args, **kwargs):
|
def create_bzip2 (archive, compression, cmd, *args, **kwargs):
|
||||||
"""Create a BZIP2 archive."""
|
"""Create a BZIP2 archive."""
|
||||||
cmdlist = [util.shell_quote(cmd)]
|
cmdlist = [util.shell_quote(cmd)]
|
||||||
if kwargs['verbose']:
|
if kwargs['verbose']:
|
||||||
|
|
|
@ -15,7 +15,7 @@
|
||||||
# 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 cabextract program."""
|
"""Archive commands for the cabextract program."""
|
||||||
|
|
||||||
def extract_cab (archive, encoding, cmd, **kwargs):
|
def extract_cab (archive, compression, cmd, **kwargs):
|
||||||
"""Extract a CAB archive."""
|
"""Extract a CAB archive."""
|
||||||
cmdlist = [cmd, '-d', kwargs['outdir']]
|
cmdlist = [cmd, '-d', kwargs['outdir']]
|
||||||
if kwargs['verbose']:
|
if kwargs['verbose']:
|
||||||
|
@ -23,7 +23,7 @@ def extract_cab (archive, encoding, cmd, **kwargs):
|
||||||
cmdlist.append(archive)
|
cmdlist.append(archive)
|
||||||
return cmdlist
|
return cmdlist
|
||||||
|
|
||||||
def list_cab (archive, encoding, cmd, **kwargs):
|
def list_cab (archive, compression, cmd, **kwargs):
|
||||||
"""List a CAB archive."""
|
"""List a CAB archive."""
|
||||||
cmdlist = [cmd, '-l']
|
cmdlist = [cmd, '-l']
|
||||||
if kwargs['verbose']:
|
if kwargs['verbose']:
|
||||||
|
@ -31,6 +31,6 @@ def list_cab (archive, encoding, cmd, **kwargs):
|
||||||
cmdlist.append(archive)
|
cmdlist.append(archive)
|
||||||
return cmdlist
|
return cmdlist
|
||||||
|
|
||||||
def test_cab (archive, encoding, cmd, **kwargs):
|
def test_cab (archive, compression, cmd, **kwargs):
|
||||||
"""Test a CAB archive."""
|
"""Test a CAB archive."""
|
||||||
return [cmd, '-t', archive]
|
return [cmd, '-t', archive]
|
||||||
|
|
|
@ -17,7 +17,7 @@
|
||||||
from patoolib import util
|
from patoolib import util
|
||||||
|
|
||||||
|
|
||||||
def create_compress (archive, encoding, cmd, *args, **kwargs):
|
def create_compress (archive, compression, cmd, *args, **kwargs):
|
||||||
"""Create a compressed archive."""
|
"""Create a compressed archive."""
|
||||||
cmdlist = [util.shell_quote(cmd)]
|
cmdlist = [util.shell_quote(cmd)]
|
||||||
if kwargs['verbose']:
|
if kwargs['verbose']:
|
||||||
|
|
|
@ -17,7 +17,7 @@
|
||||||
import os
|
import os
|
||||||
from patoolib import util
|
from patoolib import util
|
||||||
|
|
||||||
def extract_cpio (archive, encoding, cmd, **kwargs):
|
def extract_cpio (archive, compression, cmd, **kwargs):
|
||||||
"""Extract a CPIO archive."""
|
"""Extract a CPIO archive."""
|
||||||
cmdlist = [util.shell_quote(cmd), '--extract', '--make-directories',
|
cmdlist = [util.shell_quote(cmd), '--extract', '--make-directories',
|
||||||
'--preserve-modification-time', '--no-absolute-filenames',
|
'--preserve-modification-time', '--no-absolute-filenames',
|
||||||
|
@ -28,7 +28,7 @@ def extract_cpio (archive, encoding, cmd, **kwargs):
|
||||||
return (cmdlist, {'cwd': kwargs['outdir'], 'shell': True})
|
return (cmdlist, {'cwd': kwargs['outdir'], 'shell': True})
|
||||||
|
|
||||||
|
|
||||||
def list_cpio (archive, encoding, cmd, **kwargs):
|
def list_cpio (archive, compression, cmd, **kwargs):
|
||||||
"""List a CPIO archive."""
|
"""List a CPIO archive."""
|
||||||
cmdlist = [cmd, '-t']
|
cmdlist = [cmd, '-t']
|
||||||
if kwargs['verbose']:
|
if kwargs['verbose']:
|
||||||
|
@ -38,7 +38,7 @@ def list_cpio (archive, encoding, cmd, **kwargs):
|
||||||
|
|
||||||
test_cpio = list_cpio
|
test_cpio = list_cpio
|
||||||
|
|
||||||
def create_cpio(archive, encoding, cmd, *args, **kwargs):
|
def create_cpio(archive, compression, cmd, *args, **kwargs):
|
||||||
"""Create a CPIO archive."""
|
"""Create a CPIO archive."""
|
||||||
cmdlist = [util.shell_quote(cmd), '--create']
|
cmdlist = [util.shell_quote(cmd), '--create']
|
||||||
if kwargs['verbose']:
|
if kwargs['verbose']:
|
||||||
|
|
|
@ -15,7 +15,7 @@
|
||||||
# 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 dpkg-deb program."""
|
"""Archive commands for the dpkg-deb program."""
|
||||||
|
|
||||||
def extract_deb (archive, encoding, cmd, **kwargs):
|
def extract_deb (archive, compression, cmd, **kwargs):
|
||||||
"""Extract a DEB archive."""
|
"""Extract a DEB archive."""
|
||||||
cmdlist = [cmd]
|
cmdlist = [cmd]
|
||||||
if kwargs['verbose']:
|
if kwargs['verbose']:
|
||||||
|
@ -25,7 +25,7 @@ def extract_deb (archive, encoding, cmd, **kwargs):
|
||||||
cmdlist.extend(['--', archive, kwargs['outdir']])
|
cmdlist.extend(['--', archive, kwargs['outdir']])
|
||||||
return cmdlist
|
return cmdlist
|
||||||
|
|
||||||
def list_deb (archive, encoding, cmd, **kwargs):
|
def list_deb (archive, compression, cmd, **kwargs):
|
||||||
"""List a DEB archive."""
|
"""List a DEB archive."""
|
||||||
return [cmd, '--contents', '--', archive]
|
return [cmd, '--contents', '--', archive]
|
||||||
|
|
||||||
|
|
|
@ -18,31 +18,31 @@ statement."""
|
||||||
from patoolib import util
|
from patoolib import util
|
||||||
|
|
||||||
|
|
||||||
def list_bzip2 (archive, encoding, cmd, **kwargs):
|
def list_bzip2 (archive, compression, cmd, **kwargs):
|
||||||
"""List a BZIP2 archive."""
|
"""List a BZIP2 archive."""
|
||||||
return stripext(cmd, archive)
|
return stripext(cmd, archive)
|
||||||
|
|
||||||
def list_compress (archive, encoding, cmd, **kwargs):
|
def list_compress (archive, compression, cmd, **kwargs):
|
||||||
"""List a compress archive."""
|
"""List a compress archive."""
|
||||||
return stripext(cmd, archive)
|
return stripext(cmd, archive)
|
||||||
|
|
||||||
def list_lzma (archive, encoding, cmd, **kwargs):
|
def list_lzma (archive, compression, cmd, **kwargs):
|
||||||
"""List a LZMA archive."""
|
"""List a LZMA archive."""
|
||||||
return stripext(cmd, archive)
|
return stripext(cmd, archive)
|
||||||
|
|
||||||
def list_xz (archive, encoding, cmd, **kwargs):
|
def list_xz (archive, compression, cmd, **kwargs):
|
||||||
"""List a XZ archive."""
|
"""List a XZ archive."""
|
||||||
return stripext(cmd, archive)
|
return stripext(cmd, archive)
|
||||||
|
|
||||||
def list_lzip (archive, encoding, cmd, **kwargs):
|
def list_lzip (archive, compression, cmd, **kwargs):
|
||||||
"""List a LZIP archive."""
|
"""List a LZIP archive."""
|
||||||
return stripext(cmd, archive)
|
return stripext(cmd, archive)
|
||||||
|
|
||||||
def list_lrzip (archive, encoding, cmd, **kwargs):
|
def list_lrzip (archive, compression, cmd, **kwargs):
|
||||||
"""List a LRZIP archive."""
|
"""List a LRZIP archive."""
|
||||||
return stripext(cmd, archive)
|
return stripext(cmd, archive)
|
||||||
|
|
||||||
def list_rzip (archive, encoding, cmd, **kwargs):
|
def list_rzip (archive, compression, cmd, **kwargs):
|
||||||
"""List a RZIP archive."""
|
"""List a RZIP archive."""
|
||||||
return stripext(cmd, archive)
|
return stripext(cmd, archive)
|
||||||
|
|
||||||
|
|
|
@ -21,7 +21,7 @@ extract_gzip = extract_compress = extract_singlefile_standard
|
||||||
test_gzip = test_compress = test_singlefile_standard
|
test_gzip = test_compress = test_singlefile_standard
|
||||||
create_gzip = create_singlefile_standard
|
create_gzip = create_singlefile_standard
|
||||||
|
|
||||||
def list_gzip (archive, encoding, cmd, **kwargs):
|
def list_gzip (archive, compression, cmd, **kwargs):
|
||||||
"""List a GZIP archive."""
|
"""List a GZIP archive."""
|
||||||
cmdlist = [cmd]
|
cmdlist = [cmd]
|
||||||
if kwargs['verbose']:
|
if kwargs['verbose']:
|
||||||
|
|
|
@ -15,7 +15,7 @@
|
||||||
# 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 lha program."""
|
"""Archive commands for the lha program."""
|
||||||
|
|
||||||
def extract_lzh (archive, encoding, cmd, **kwargs):
|
def extract_lzh (archive, compression, cmd, **kwargs):
|
||||||
"""Extract a LZH archive."""
|
"""Extract a LZH archive."""
|
||||||
opts = 'x'
|
opts = 'x'
|
||||||
if kwargs['verbose']:
|
if kwargs['verbose']:
|
||||||
|
@ -23,7 +23,7 @@ def extract_lzh (archive, encoding, cmd, **kwargs):
|
||||||
opts += "w=%s" % kwargs['outdir']
|
opts += "w=%s" % kwargs['outdir']
|
||||||
return [cmd, opts, archive]
|
return [cmd, opts, archive]
|
||||||
|
|
||||||
def list_lzh (archive, encoding, cmd, **kwargs):
|
def list_lzh (archive, compression, cmd, **kwargs):
|
||||||
"""List a LZH archive."""
|
"""List a LZH archive."""
|
||||||
cmdlist = [cmd]
|
cmdlist = [cmd]
|
||||||
if kwargs['verbose']:
|
if kwargs['verbose']:
|
||||||
|
@ -33,14 +33,14 @@ def list_lzh (archive, encoding, cmd, **kwargs):
|
||||||
cmdlist.append(archive)
|
cmdlist.append(archive)
|
||||||
return cmdlist
|
return cmdlist
|
||||||
|
|
||||||
def test_lzh (archive, encoding, cmd, **kwargs):
|
def test_lzh (archive, compression, cmd, **kwargs):
|
||||||
"""Test a LZH archive."""
|
"""Test a LZH archive."""
|
||||||
opts = 't'
|
opts = 't'
|
||||||
if kwargs['verbose']:
|
if kwargs['verbose']:
|
||||||
opts += 'v'
|
opts += 'v'
|
||||||
return [cmd, opts, archive]
|
return [cmd, opts, archive]
|
||||||
|
|
||||||
def create_lzh (archive, encoding, cmd, *args, **kwargs):
|
def create_lzh (archive, compression, cmd, *args, **kwargs):
|
||||||
"""Create a LZH archive."""
|
"""Create a LZH archive."""
|
||||||
opts = 'a'
|
opts = 'a'
|
||||||
if kwargs['verbose']:
|
if kwargs['verbose']:
|
||||||
|
|
|
@ -17,7 +17,7 @@
|
||||||
import os
|
import os
|
||||||
from patoolib import util
|
from patoolib import util
|
||||||
|
|
||||||
def extract_lrzip (archive, encoding, cmd, **kwargs):
|
def extract_lrzip (archive, compression, cmd, **kwargs):
|
||||||
"""Extract a LRZIP archive."""
|
"""Extract a LRZIP archive."""
|
||||||
# Since extracted files will be placed in the current directory,
|
# Since extracted files will be placed in the current directory,
|
||||||
# the cwd argument has to be the output directory.
|
# the cwd argument has to be the output directory.
|
||||||
|
@ -28,7 +28,7 @@ def extract_lrzip (archive, encoding, cmd, **kwargs):
|
||||||
cmdlist.extend(["-o", outfile, os.path.abspath(archive)])
|
cmdlist.extend(["-o", outfile, os.path.abspath(archive)])
|
||||||
return (cmdlist, {'cwd': kwargs['outdir']})
|
return (cmdlist, {'cwd': kwargs['outdir']})
|
||||||
|
|
||||||
def test_lrzip (archive, encoding, cmd, **kwargs):
|
def test_lrzip (archive, compression, cmd, **kwargs):
|
||||||
"""Test a LRZIP archive."""
|
"""Test a LRZIP archive."""
|
||||||
cmdlist = [cmd, '-t']
|
cmdlist = [cmd, '-t']
|
||||||
if kwargs['verbose']:
|
if kwargs['verbose']:
|
||||||
|
@ -36,7 +36,7 @@ def test_lrzip (archive, encoding, cmd, **kwargs):
|
||||||
cmdlist.append(archive)
|
cmdlist.append(archive)
|
||||||
return cmdlist
|
return cmdlist
|
||||||
|
|
||||||
def create_lrzip (archive, encoding, cmd, *args, **kwargs):
|
def create_lrzip (archive, compression, cmd, *args, **kwargs):
|
||||||
"""Create a LRZIP archive."""
|
"""Create a LRZIP archive."""
|
||||||
cmdlist = [cmd, '-o', archive]
|
cmdlist = [cmd, '-o', archive]
|
||||||
if kwargs['verbose']:
|
if kwargs['verbose']:
|
||||||
|
|
|
@ -20,7 +20,7 @@ from patoolib.programs import extract_singlefile_standard
|
||||||
extract_lzop = extract_singlefile_standard
|
extract_lzop = extract_singlefile_standard
|
||||||
|
|
||||||
|
|
||||||
def list_lzop (archive, encoding, cmd, **kwargs):
|
def list_lzop (archive, compression, cmd, **kwargs):
|
||||||
"""List a LZOP archive."""
|
"""List a LZOP archive."""
|
||||||
cmdlist = [cmd, '--list']
|
cmdlist = [cmd, '--list']
|
||||||
if kwargs['verbose']:
|
if kwargs['verbose']:
|
||||||
|
@ -28,7 +28,7 @@ def list_lzop (archive, encoding, cmd, **kwargs):
|
||||||
cmdlist.extend(['--', archive])
|
cmdlist.extend(['--', archive])
|
||||||
return cmdlist
|
return cmdlist
|
||||||
|
|
||||||
def test_lzop (archive, encoding, cmd, **kwargs):
|
def test_lzop (archive, compression, cmd, **kwargs):
|
||||||
"""Test a LZOP archive."""
|
"""Test a LZOP archive."""
|
||||||
cmdlist = [cmd, '--test']
|
cmdlist = [cmd, '--test']
|
||||||
if kwargs['verbose']:
|
if kwargs['verbose']:
|
||||||
|
@ -36,7 +36,7 @@ def test_lzop (archive, encoding, cmd, **kwargs):
|
||||||
cmdlist.extend(['--', archive])
|
cmdlist.extend(['--', archive])
|
||||||
return cmdlist
|
return cmdlist
|
||||||
|
|
||||||
def create_lzop (archive, encoding, cmd, *args, **kwargs):
|
def create_lzop (archive, compression, cmd, *args, **kwargs):
|
||||||
"""Create a LZOP archive."""
|
"""Create a LZOP archive."""
|
||||||
cmdlist = [cmd]
|
cmdlist = [cmd]
|
||||||
if kwargs['verbose']:
|
if kwargs['verbose']:
|
||||||
|
|
|
@ -16,14 +16,14 @@
|
||||||
"""Archive commands for the nomarch program."""
|
"""Archive commands for the nomarch program."""
|
||||||
import os
|
import os
|
||||||
|
|
||||||
def extract_arc (archive, encoding, cmd, **kwargs):
|
def extract_arc (archive, compression, cmd, **kwargs):
|
||||||
"""Extract a ARC archive."""
|
"""Extract a ARC archive."""
|
||||||
# Since extracted files will be placed in the current directory,
|
# Since extracted files will be placed in the current directory,
|
||||||
# the cwd argument has to be the output directory.
|
# the cwd argument has to be the output directory.
|
||||||
cmdlist = [cmd, os.path.abspath(archive)]
|
cmdlist = [cmd, os.path.abspath(archive)]
|
||||||
return (cmdlist, {'cwd': kwargs['outdir']})
|
return (cmdlist, {'cwd': kwargs['outdir']})
|
||||||
|
|
||||||
def list_arc (archive, encoding, cmd, **kwargs):
|
def list_arc (archive, compression, cmd, **kwargs):
|
||||||
"""List a ARC archive."""
|
"""List a ARC archive."""
|
||||||
cmdlist = [cmd, '-l']
|
cmdlist = [cmd, '-l']
|
||||||
if kwargs['verbose']:
|
if kwargs['verbose']:
|
||||||
|
@ -31,6 +31,6 @@ def list_arc (archive, encoding, cmd, **kwargs):
|
||||||
cmdlist.append(archive)
|
cmdlist.append(archive)
|
||||||
return cmdlist
|
return cmdlist
|
||||||
|
|
||||||
def test_arc (archive, encoding, cmd, **kwargs):
|
def test_arc (archive, compression, cmd, **kwargs):
|
||||||
"""Test a ARC archive."""
|
"""Test a ARC archive."""
|
||||||
return [cmd, '-t', archive]
|
return [cmd, '-t', archive]
|
||||||
|
|
|
@ -15,7 +15,7 @@
|
||||||
# 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 orange program."""
|
"""Archive commands for the orange program."""
|
||||||
|
|
||||||
def extract_cab (archive, encoding, cmd, **kwargs):
|
def extract_cab (archive, compression, cmd, **kwargs):
|
||||||
"""Extract a CAB archive."""
|
"""Extract a CAB archive."""
|
||||||
cmdlist = [cmd, '-d', kwargs['outdir']]
|
cmdlist = [cmd, '-d', kwargs['outdir']]
|
||||||
if kwargs['verbose']:
|
if kwargs['verbose']:
|
||||||
|
|
|
@ -15,7 +15,7 @@
|
||||||
# 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 7z program."""
|
"""Archive commands for the 7z program."""
|
||||||
|
|
||||||
def extract_7z (archive, encoding, cmd, **kwargs):
|
def extract_7z (archive, compression, cmd, **kwargs):
|
||||||
"""Extract a 7z archive."""
|
"""Extract a 7z archive."""
|
||||||
cmdlist = [cmd, 'x']
|
cmdlist = [cmd, 'x']
|
||||||
if not kwargs['verbose']:
|
if not kwargs['verbose']:
|
||||||
|
@ -35,7 +35,7 @@ extract_bzip2 = \
|
||||||
extract_deb = \
|
extract_deb = \
|
||||||
extract_7z
|
extract_7z
|
||||||
|
|
||||||
def list_7z (archive, encoding, cmd, **kwargs):
|
def list_7z (archive, compression, cmd, **kwargs):
|
||||||
"""List a 7z archive."""
|
"""List a 7z archive."""
|
||||||
cmdlist = [cmd, 'l']
|
cmdlist = [cmd, 'l']
|
||||||
if not kwargs['verbose']:
|
if not kwargs['verbose']:
|
||||||
|
@ -57,7 +57,7 @@ list_bzip2 = \
|
||||||
list_7z
|
list_7z
|
||||||
|
|
||||||
|
|
||||||
def test_7z (archive, encoding, cmd, **kwargs):
|
def test_7z (archive, compression, cmd, **kwargs):
|
||||||
"""Test a 7z archive."""
|
"""Test a 7z archive."""
|
||||||
cmdlist = [cmd, 't']
|
cmdlist = [cmd, 't']
|
||||||
if not kwargs['verbose']:
|
if not kwargs['verbose']:
|
||||||
|
@ -79,7 +79,7 @@ test_bzip2 = \
|
||||||
test_7z
|
test_7z
|
||||||
|
|
||||||
|
|
||||||
def create_7z (archive, encoding, cmd, *args, **kwargs):
|
def create_7z (archive, compression, cmd, *args, **kwargs):
|
||||||
"""Create a 7z archive."""
|
"""Create a 7z archive."""
|
||||||
cmdlist = [cmd, 'a']
|
cmdlist = [cmd, 'a']
|
||||||
if not kwargs['verbose']:
|
if not kwargs['verbose']:
|
||||||
|
|
|
@ -23,7 +23,7 @@ except ImportError:
|
||||||
|
|
||||||
READ_SIZE_BYTES = 1024*1024
|
READ_SIZE_BYTES = 1024*1024
|
||||||
|
|
||||||
def extract_bzip2 (archive, encoding, cmd, **kwargs):
|
def extract_bzip2 (archive, compression, cmd, **kwargs):
|
||||||
"""Extract a BZIP2 archive with the bz2 Python module."""
|
"""Extract a BZIP2 archive with the bz2 Python module."""
|
||||||
verbose = kwargs['verbose']
|
verbose = kwargs['verbose']
|
||||||
outdir = kwargs['outdir']
|
outdir = kwargs['outdir']
|
||||||
|
@ -48,7 +48,7 @@ def extract_bzip2 (archive, encoding, cmd, **kwargs):
|
||||||
return None
|
return None
|
||||||
|
|
||||||
|
|
||||||
def create_bzip2 (archive, encoding, cmd, *args, **kwargs):
|
def create_bzip2 (archive, compression, cmd, *args, **kwargs):
|
||||||
"""Create a BZIP2 archive with the bz2 Python module."""
|
"""Create a BZIP2 archive with the bz2 Python module."""
|
||||||
verbose = kwargs['verbose']
|
verbose = kwargs['verbose']
|
||||||
if verbose:
|
if verbose:
|
||||||
|
|
|
@ -21,7 +21,7 @@ from patoolib import util
|
||||||
|
|
||||||
READ_SIZE_BYTES = 1024*1024
|
READ_SIZE_BYTES = 1024*1024
|
||||||
|
|
||||||
def extract_gzip (archive, encoding, cmd, **kwargs):
|
def extract_gzip (archive, compression, cmd, **kwargs):
|
||||||
"""Extract a GZIP archive with the gzip Python module."""
|
"""Extract a GZIP archive with the gzip Python module."""
|
||||||
verbose = kwargs['verbose']
|
verbose = kwargs['verbose']
|
||||||
outdir = kwargs['outdir']
|
outdir = kwargs['outdir']
|
||||||
|
@ -46,7 +46,7 @@ def extract_gzip (archive, encoding, cmd, **kwargs):
|
||||||
return None
|
return None
|
||||||
|
|
||||||
|
|
||||||
def create_gzip (archive, encoding, cmd, *args, **kwargs):
|
def create_gzip (archive, compression, cmd, *args, **kwargs):
|
||||||
"""Create a GZIP archive with the gzip Python module."""
|
"""Create a GZIP archive with the gzip Python module."""
|
||||||
verbose = kwargs['verbose']
|
verbose = kwargs['verbose']
|
||||||
if verbose:
|
if verbose:
|
||||||
|
|
|
@ -20,7 +20,7 @@ import tarfile
|
||||||
READ_SIZE_BYTES = 1024*1024
|
READ_SIZE_BYTES = 1024*1024
|
||||||
|
|
||||||
|
|
||||||
def list_tar (archive, encoding, cmd, **kwargs):
|
def list_tar (archive, compression, cmd, **kwargs):
|
||||||
"""List a TAR archive with the tarfile Python module."""
|
"""List a TAR archive with the tarfile Python module."""
|
||||||
verbose = kwargs['verbose']
|
verbose = kwargs['verbose']
|
||||||
if verbose:
|
if verbose:
|
||||||
|
@ -34,7 +34,7 @@ def list_tar (archive, encoding, cmd, **kwargs):
|
||||||
|
|
||||||
test_tar = list_tar
|
test_tar = list_tar
|
||||||
|
|
||||||
def extract_tar (archive, encoding, cmd, **kwargs):
|
def extract_tar (archive, compression, cmd, **kwargs):
|
||||||
"""Extract a TAR archive with the tarfile Python module."""
|
"""Extract a TAR archive with the tarfile Python module."""
|
||||||
verbose = kwargs['verbose']
|
verbose = kwargs['verbose']
|
||||||
outdir = kwargs['outdir']
|
outdir = kwargs['outdir']
|
||||||
|
@ -51,12 +51,12 @@ def extract_tar (archive, encoding, cmd, **kwargs):
|
||||||
return None
|
return None
|
||||||
|
|
||||||
|
|
||||||
def create_tar (archive, encoding, cmd, *args, **kwargs):
|
def create_tar (archive, compression, cmd, *args, **kwargs):
|
||||||
"""Create a TAR archive with the tarfile Python module."""
|
"""Create a TAR archive with the tarfile Python module."""
|
||||||
verbose = kwargs['verbose']
|
verbose = kwargs['verbose']
|
||||||
if verbose:
|
if verbose:
|
||||||
util.log_info('creating %s...' % archive)
|
util.log_info('creating %s...' % archive)
|
||||||
mode = get_tar_mode(encoding)
|
mode = get_tar_mode(compression)
|
||||||
tfile = tarfile.open(archive, mode)
|
tfile = tarfile.open(archive, mode)
|
||||||
try:
|
try:
|
||||||
for filename in args:
|
for filename in args:
|
||||||
|
|
|
@ -20,7 +20,7 @@ import zipfile
|
||||||
READ_SIZE_BYTES = 1024*1024
|
READ_SIZE_BYTES = 1024*1024
|
||||||
|
|
||||||
|
|
||||||
def list_zip (archive, encoding, cmd, **kwargs):
|
def list_zip (archive, compression, cmd, **kwargs):
|
||||||
"""List member of a ZIP archive with the zipfile Python module."""
|
"""List member of a ZIP archive with the zipfile Python module."""
|
||||||
verbose = kwargs['verbose']
|
verbose = kwargs['verbose']
|
||||||
if verbose:
|
if verbose:
|
||||||
|
@ -35,7 +35,7 @@ def list_zip (archive, encoding, cmd, **kwargs):
|
||||||
|
|
||||||
test_zip = list_zip
|
test_zip = list_zip
|
||||||
|
|
||||||
def extract_zip (archive, encoding, cmd, **kwargs):
|
def extract_zip (archive, compression, cmd, **kwargs):
|
||||||
"""Extract a ZIP archive with the zipfile Python module."""
|
"""Extract a ZIP archive with the zipfile Python module."""
|
||||||
verbose = kwargs['verbose']
|
verbose = kwargs['verbose']
|
||||||
outdir = kwargs['outdir']
|
outdir = kwargs['outdir']
|
||||||
|
@ -52,7 +52,7 @@ def extract_zip (archive, encoding, cmd, **kwargs):
|
||||||
return None
|
return None
|
||||||
|
|
||||||
|
|
||||||
def create_zip (archive, encoding, cmd, *args, **kwargs):
|
def create_zip (archive, compression, cmd, *args, **kwargs):
|
||||||
"""Create a ZIP archive with the zipfile Python module."""
|
"""Create a ZIP archive with the zipfile Python module."""
|
||||||
verbose = kwargs['verbose']
|
verbose = kwargs['verbose']
|
||||||
if verbose:
|
if verbose:
|
||||||
|
|
|
@ -16,7 +16,7 @@
|
||||||
"""Archive commands for the rar program."""
|
"""Archive commands for the rar program."""
|
||||||
import os
|
import os
|
||||||
|
|
||||||
def extract_rar (archive, encoding, cmd, **kwargs):
|
def extract_rar (archive, compression, cmd, **kwargs):
|
||||||
"""Extract a RAR archive."""
|
"""Extract a RAR archive."""
|
||||||
cmdlist = [cmd, 'x']
|
cmdlist = [cmd, 'x']
|
||||||
if not kwargs['verbose']:
|
if not kwargs['verbose']:
|
||||||
|
@ -24,7 +24,7 @@ def extract_rar (archive, encoding, cmd, **kwargs):
|
||||||
cmdlist.extend(['--', os.path.abspath(archive)])
|
cmdlist.extend(['--', os.path.abspath(archive)])
|
||||||
return (cmdlist, {'cwd': kwargs['outdir']})
|
return (cmdlist, {'cwd': kwargs['outdir']})
|
||||||
|
|
||||||
def list_rar (archive, encoding, cmd, **kwargs):
|
def list_rar (archive, compression, cmd, **kwargs):
|
||||||
"""List a RAR archive."""
|
"""List a RAR archive."""
|
||||||
cmdlist = [cmd]
|
cmdlist = [cmd]
|
||||||
if kwargs['verbose']:
|
if kwargs['verbose']:
|
||||||
|
@ -35,7 +35,7 @@ def list_rar (archive, encoding, cmd, **kwargs):
|
||||||
cmdlist.extend(['--', archive])
|
cmdlist.extend(['--', archive])
|
||||||
return cmdlist
|
return cmdlist
|
||||||
|
|
||||||
def test_rar (archive, encoding, cmd, **kwargs):
|
def test_rar (archive, compression, cmd, **kwargs):
|
||||||
"""Test a RAR archive."""
|
"""Test a RAR archive."""
|
||||||
cmdlist = [cmd, 't']
|
cmdlist = [cmd, 't']
|
||||||
if not kwargs['verbose']:
|
if not kwargs['verbose']:
|
||||||
|
@ -43,7 +43,7 @@ def test_rar (archive, encoding, cmd, **kwargs):
|
||||||
cmdlist.extend(['--', archive])
|
cmdlist.extend(['--', archive])
|
||||||
return cmdlist
|
return cmdlist
|
||||||
|
|
||||||
def create_rar (archive, encoding, cmd, *args, **kwargs):
|
def create_rar (archive, compression, cmd, *args, **kwargs):
|
||||||
"""Create a RAR archive."""
|
"""Create a RAR archive."""
|
||||||
cmdlist = [cmd, 'a']
|
cmdlist = [cmd, 'a']
|
||||||
if not kwargs['verbose']:
|
if not kwargs['verbose']:
|
||||||
|
|
|
@ -15,7 +15,7 @@
|
||||||
# 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 rpm program."""
|
"""Archive commands for the rpm program."""
|
||||||
|
|
||||||
def list_rpm (archive, encoding, cmd, **kwargs):
|
def list_rpm (archive, compression, cmd, **kwargs):
|
||||||
"""List a RPM archive."""
|
"""List a RPM archive."""
|
||||||
cmdlist = [cmd, '-q', '-l']
|
cmdlist = [cmd, '-q', '-l']
|
||||||
if kwargs['verbose']:
|
if kwargs['verbose']:
|
||||||
|
@ -23,7 +23,7 @@ def list_rpm (archive, encoding, cmd, **kwargs):
|
||||||
cmdlist.extend(['-p', '--', archive])
|
cmdlist.extend(['-p', '--', archive])
|
||||||
return cmdlist
|
return cmdlist
|
||||||
|
|
||||||
def test_rpm (archive, encoding, cmd, **kwargs):
|
def test_rpm (archive, compression, cmd, **kwargs):
|
||||||
"""Test a RPM archive."""
|
"""Test a RPM archive."""
|
||||||
cmdlist = [cmd, 'V']
|
cmdlist = [cmd, 'V']
|
||||||
if kwargs['verbose']:
|
if kwargs['verbose']:
|
||||||
|
|
|
@ -17,7 +17,7 @@
|
||||||
import os
|
import os
|
||||||
from patoolib import util
|
from patoolib import util
|
||||||
|
|
||||||
def extract_rpm (archive, encoding, cmd, **kwargs):
|
def extract_rpm (archive, compression, cmd, **kwargs):
|
||||||
"""Extract a RPM archive."""
|
"""Extract a RPM archive."""
|
||||||
# also check cpio
|
# also check cpio
|
||||||
cpio = util.find_program("cpio")
|
cpio = util.find_program("cpio")
|
||||||
|
|
|
@ -17,7 +17,7 @@
|
||||||
import os
|
import os
|
||||||
from patoolib import util
|
from patoolib import util
|
||||||
|
|
||||||
def extract_rzip (archive, encoding, cmd, **kwargs):
|
def extract_rzip (archive, compression, cmd, **kwargs):
|
||||||
"""Extract a RZIP archive."""
|
"""Extract a RZIP archive."""
|
||||||
# Since extracted files will be placed in the current directory,
|
# Since extracted files will be placed in the current directory,
|
||||||
# the cwd argument has to be the output directory.
|
# the cwd argument has to be the output directory.
|
||||||
|
@ -28,7 +28,7 @@ def extract_rzip (archive, encoding, cmd, **kwargs):
|
||||||
cmdlist.extend(["-o", outfile, os.path.abspath(archive)])
|
cmdlist.extend(["-o", outfile, os.path.abspath(archive)])
|
||||||
return (cmdlist, {'cwd': kwargs['outdir']})
|
return (cmdlist, {'cwd': kwargs['outdir']})
|
||||||
|
|
||||||
def create_rzip (archive, encoding, cmd, *args, **kwargs):
|
def create_rzip (archive, compression, cmd, *args, **kwargs):
|
||||||
"""Create a RZIP archive."""
|
"""Create a RZIP archive."""
|
||||||
cmdlist = [cmd, '-k', '-o', archive]
|
cmdlist = [cmd, '-k', '-o', archive]
|
||||||
if kwargs['verbose']:
|
if kwargs['verbose']:
|
||||||
|
|
|
@ -15,42 +15,42 @@
|
||||||
# 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 star program."""
|
"""Archive commands for the star program."""
|
||||||
|
|
||||||
def extract_tar (archive, encoding, cmd, **kwargs):
|
def extract_tar (archive, compression, cmd, **kwargs):
|
||||||
"""Extract a TAR archive."""
|
"""Extract a TAR archive."""
|
||||||
cmdlist = [cmd, '-x']
|
cmdlist = [cmd, '-x']
|
||||||
add_star_opts(cmdlist, encoding, kwargs['verbose'])
|
add_star_opts(cmdlist, compression, kwargs['verbose'])
|
||||||
cmdlist.extend(['-C', kwargs['outdir'], 'file=%s' % archive])
|
cmdlist.extend(['-C', kwargs['outdir'], 'file=%s' % archive])
|
||||||
return cmdlist
|
return cmdlist
|
||||||
|
|
||||||
def list_tar (archive, encoding, cmd, **kwargs):
|
def list_tar (archive, compression, cmd, **kwargs):
|
||||||
"""List a TAR archive."""
|
"""List a TAR archive."""
|
||||||
cmdlist = [cmd, '-n']
|
cmdlist = [cmd, '-n']
|
||||||
add_star_opts(cmdlist, encoding, kwargs['verbose'])
|
add_star_opts(cmdlist, compression, kwargs['verbose'])
|
||||||
cmdlist.append("file=%s" % archive)
|
cmdlist.append("file=%s" % archive)
|
||||||
return cmdlist
|
return cmdlist
|
||||||
|
|
||||||
test_tar = list_tar
|
test_tar = list_tar
|
||||||
|
|
||||||
def create_tar (archive, encoding, cmd, *args, **kwargs):
|
def create_tar (archive, compression, cmd, *args, **kwargs):
|
||||||
"""Create a TAR archive."""
|
"""Create a TAR archive."""
|
||||||
cmdlist = [cmd, '-c']
|
cmdlist = [cmd, '-c']
|
||||||
add_star_opts(cmdlist, encoding, kwargs['verbose'])
|
add_star_opts(cmdlist, compression, kwargs['verbose'])
|
||||||
cmdlist.append("file=%s" % archive)
|
cmdlist.append("file=%s" % archive)
|
||||||
cmdlist.extend(args)
|
cmdlist.extend(args)
|
||||||
return cmdlist
|
return cmdlist
|
||||||
|
|
||||||
def add_star_opts (cmdlist, encoding, verbose):
|
def add_star_opts (cmdlist, compression, verbose):
|
||||||
"""Add default options for the star program."""
|
"""Add default options for the star program."""
|
||||||
# Note that star autodetects encoding compression, but displays a warning
|
# Note that star autodetects compression compression, but displays a warning
|
||||||
# which we want to avoid.
|
# which we want to avoid.
|
||||||
if encoding == 'gzip':
|
if compression == 'gzip':
|
||||||
cmdlist.append('-z')
|
cmdlist.append('-z')
|
||||||
elif encoding == 'compress':
|
elif compression == 'compress':
|
||||||
cmdlist.append('-Z')
|
cmdlist.append('-Z')
|
||||||
elif encoding == 'bzip2':
|
elif compression == 'bzip2':
|
||||||
cmdlist.append('-bz')
|
cmdlist.append('-bz')
|
||||||
elif encoding in ('lzma', 'xz', 'lzip'):
|
elif compression in ('lzma', 'xz', 'lzip'):
|
||||||
# use compress-program option
|
# use compress-program option
|
||||||
cmdlist.append('compress-program=%s' % encoding)
|
cmdlist.append('compress-program=%s' % compression)
|
||||||
if verbose:
|
if verbose:
|
||||||
cmdlist.append('-v')
|
cmdlist.append('-v')
|
||||||
|
|
|
@ -15,35 +15,35 @@
|
||||||
# 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 GNU tar program."""
|
"""Archive commands for the GNU tar program."""
|
||||||
|
|
||||||
def extract_tar (archive, encoding, cmd, **kwargs):
|
def extract_tar (archive, compression, cmd, **kwargs):
|
||||||
"""Extract a TAR archive."""
|
"""Extract a TAR archive."""
|
||||||
cmdlist = [cmd, '--extract']
|
cmdlist = [cmd, '--extract']
|
||||||
add_tar_opts(cmdlist, encoding, kwargs['verbose'])
|
add_tar_opts(cmdlist, compression, kwargs['verbose'])
|
||||||
cmdlist.extend(["--file", archive, '--directory', kwargs['outdir']])
|
cmdlist.extend(["--file", archive, '--directory', kwargs['outdir']])
|
||||||
return cmdlist
|
return cmdlist
|
||||||
|
|
||||||
def list_tar (archive, encoding, cmd, **kwargs):
|
def list_tar (archive, compression, cmd, **kwargs):
|
||||||
"""List a TAR archive."""
|
"""List a TAR archive."""
|
||||||
cmdlist = [cmd, '--list']
|
cmdlist = [cmd, '--list']
|
||||||
add_tar_opts(cmdlist, encoding, kwargs['verbose'])
|
add_tar_opts(cmdlist, compression, kwargs['verbose'])
|
||||||
cmdlist.extend(["--file", archive])
|
cmdlist.extend(["--file", archive])
|
||||||
return cmdlist
|
return cmdlist
|
||||||
|
|
||||||
test_tar = list_tar
|
test_tar = list_tar
|
||||||
|
|
||||||
def create_tar (archive, encoding, cmd, *args, **kwargs):
|
def create_tar (archive, compression, cmd, *args, **kwargs):
|
||||||
"""Create a TAR archive."""
|
"""Create a TAR archive."""
|
||||||
cmdlist = [cmd, '--create']
|
cmdlist = [cmd, '--create']
|
||||||
add_tar_opts(cmdlist, encoding, kwargs['verbose'])
|
add_tar_opts(cmdlist, compression, kwargs['verbose'])
|
||||||
cmdlist.extend(["--file", archive, '--'])
|
cmdlist.extend(["--file", archive, '--'])
|
||||||
cmdlist.extend(args)
|
cmdlist.extend(args)
|
||||||
return cmdlist
|
return cmdlist
|
||||||
|
|
||||||
def add_tar_opts (cmdlist, encoding, verbose):
|
def add_tar_opts (cmdlist, compression, verbose):
|
||||||
if encoding == 'lzip':
|
if compression == 'lzip':
|
||||||
# use compress-program option
|
# use compress-program option
|
||||||
cmdlist.extend(['--use-compress-program', encoding])
|
cmdlist.extend(['--use-compress-program', compression])
|
||||||
elif encoding:
|
elif compression:
|
||||||
cmdlist.append('--%s' % encoding)
|
cmdlist.append('--%s' % compression)
|
||||||
if verbose:
|
if verbose:
|
||||||
cmdlist.append('--verbose')
|
cmdlist.append('--verbose')
|
||||||
|
|
|
@ -15,7 +15,7 @@
|
||||||
# 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 unace program."""
|
"""Archive commands for the unace program."""
|
||||||
|
|
||||||
def extract_ace (archive, encoding, cmd, **kwargs):
|
def extract_ace (archive, compression, cmd, **kwargs):
|
||||||
"""Extract a ACE archive."""
|
"""Extract a ACE archive."""
|
||||||
cmdlist = [cmd, 'x']
|
cmdlist = [cmd, 'x']
|
||||||
if not kwargs['verbose']:
|
if not kwargs['verbose']:
|
||||||
|
@ -23,7 +23,7 @@ def extract_ace (archive, encoding, cmd, **kwargs):
|
||||||
cmdlist.extend([archive, kwargs['outdir']])
|
cmdlist.extend([archive, kwargs['outdir']])
|
||||||
return cmdlist
|
return cmdlist
|
||||||
|
|
||||||
def list_ace (archive, encoding, cmd, **kwargs):
|
def list_ace (archive, compression, cmd, **kwargs):
|
||||||
"""List a ACE archive."""
|
"""List a ACE archive."""
|
||||||
cmdlist = [cmd]
|
cmdlist = [cmd]
|
||||||
if kwargs['verbose']:
|
if kwargs['verbose']:
|
||||||
|
@ -34,7 +34,7 @@ def list_ace (archive, encoding, cmd, **kwargs):
|
||||||
cmdlist.append(archive)
|
cmdlist.append(archive)
|
||||||
return cmdlist
|
return cmdlist
|
||||||
|
|
||||||
def test_ace (archive, encoding, cmd, **kwargs):
|
def test_ace (archive, compression, cmd, **kwargs):
|
||||||
"""Test a ACE archive."""
|
"""Test a ACE archive."""
|
||||||
cmdlist = [cmd, 't']
|
cmdlist = [cmd, 't']
|
||||||
if not kwargs['verbose']:
|
if not kwargs['verbose']:
|
||||||
|
|
|
@ -15,12 +15,12 @@
|
||||||
# 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 unalz program."""
|
"""Archive commands for the unalz program."""
|
||||||
|
|
||||||
def extract_alzip (archive, encoding, cmd, **kwargs):
|
def extract_alzip (archive, compression, cmd, **kwargs):
|
||||||
"""Extract a ALZIP archive."""
|
"""Extract a ALZIP archive."""
|
||||||
return [cmd, '-d', kwargs['outdir'], archive]
|
return [cmd, '-d', kwargs['outdir'], archive]
|
||||||
|
|
||||||
|
|
||||||
def list_alzip (archive, encoding, cmd, **kwargs):
|
def list_alzip (archive, compression, cmd, **kwargs):
|
||||||
"""List a ALZIP archive."""
|
"""List a ALZIP archive."""
|
||||||
return [cmd, '-l', archive]
|
return [cmd, '-l', archive]
|
||||||
|
|
||||||
|
|
|
@ -17,7 +17,7 @@
|
||||||
from patoolib import util
|
from patoolib import util
|
||||||
|
|
||||||
|
|
||||||
def extract_compress (archive, encoding, cmd, **kwargs):
|
def extract_compress (archive, compression, cmd, **kwargs):
|
||||||
"""Extract a compressed archive."""
|
"""Extract a compressed archive."""
|
||||||
cmdlist = [util.shell_quote(cmd)]
|
cmdlist = [util.shell_quote(cmd)]
|
||||||
if kwargs['verbose']:
|
if kwargs['verbose']:
|
||||||
|
|
|
@ -15,7 +15,7 @@
|
||||||
# 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 unzip program."""
|
"""Archive commands for the unzip program."""
|
||||||
|
|
||||||
def extract_zip (archive, encoding, cmd, **kwargs):
|
def extract_zip (archive, compression, cmd, **kwargs):
|
||||||
"""Extract a ZIP archive."""
|
"""Extract a ZIP archive."""
|
||||||
cmdlist = [cmd]
|
cmdlist = [cmd]
|
||||||
if kwargs['verbose']:
|
if kwargs['verbose']:
|
||||||
|
@ -23,7 +23,7 @@ def extract_zip (archive, encoding, cmd, **kwargs):
|
||||||
cmdlist.extend(['--', archive, '-d', kwargs['outdir']])
|
cmdlist.extend(['--', archive, '-d', kwargs['outdir']])
|
||||||
return cmdlist
|
return cmdlist
|
||||||
|
|
||||||
def list_zip (archive, encoding, cmd, **kwargs):
|
def list_zip (archive, compression, cmd, **kwargs):
|
||||||
"""List a ZIP archive."""
|
"""List a ZIP archive."""
|
||||||
cmdlist = [cmd, '-l']
|
cmdlist = [cmd, '-l']
|
||||||
if kwargs['verbose']:
|
if kwargs['verbose']:
|
||||||
|
@ -31,7 +31,7 @@ def list_zip (archive, encoding, cmd, **kwargs):
|
||||||
cmdlist.extend(['--', archive])
|
cmdlist.extend(['--', archive])
|
||||||
return cmdlist
|
return cmdlist
|
||||||
|
|
||||||
def test_zip (archive, encoding, cmd, **kwargs):
|
def test_zip (archive, compression, cmd, **kwargs):
|
||||||
"""Test a ZIP archive."""
|
"""Test a ZIP archive."""
|
||||||
cmdlist = [cmd, '-t']
|
cmdlist = [cmd, '-t']
|
||||||
if kwargs['verbose']:
|
if kwargs['verbose']:
|
||||||
|
|
|
@ -17,7 +17,7 @@
|
||||||
from patoolib import util
|
from patoolib import util
|
||||||
|
|
||||||
|
|
||||||
def extract_dms (archive, encoding, cmd, **kwargs):
|
def extract_dms (archive, compression, cmd, **kwargs):
|
||||||
"""Extract a DMS archive."""
|
"""Extract a DMS archive."""
|
||||||
check_archive_ext(archive)
|
check_archive_ext(archive)
|
||||||
cmdlist = [cmd, '-d', kwargs['outdir']]
|
cmdlist = [cmd, '-d', kwargs['outdir']]
|
||||||
|
@ -27,13 +27,13 @@ def extract_dms (archive, encoding, cmd, **kwargs):
|
||||||
return cmdlist
|
return cmdlist
|
||||||
|
|
||||||
|
|
||||||
def list_dms (archive, encoding, cmd, **kwargs):
|
def list_dms (archive, compression, cmd, **kwargs):
|
||||||
"""List a DMS archive."""
|
"""List a DMS archive."""
|
||||||
check_archive_ext(archive)
|
check_archive_ext(archive)
|
||||||
return [cmd, 'v', archive]
|
return [cmd, 'v', archive]
|
||||||
|
|
||||||
|
|
||||||
def test_dms (archive, encoding, cmd, **kwargs):
|
def test_dms (archive, compression, cmd, **kwargs):
|
||||||
"""Test a DMS archive."""
|
"""Test a DMS archive."""
|
||||||
check_archive_ext(archive)
|
check_archive_ext(archive)
|
||||||
return [cmd, 't', archive]
|
return [cmd, 't', archive]
|
||||||
|
|
|
@ -22,7 +22,7 @@ extract_xz = extract_singlefile_standard
|
||||||
test_xz = test_singlefile_standard
|
test_xz = test_singlefile_standard
|
||||||
create_xz = create_singlefile_standard
|
create_xz = create_singlefile_standard
|
||||||
|
|
||||||
def list_xz (archive, encoding, cmd, **kwargs):
|
def list_xz (archive, compression, cmd, **kwargs):
|
||||||
"""List a XZ archive."""
|
"""List a XZ archive."""
|
||||||
cmdlist = [cmd]
|
cmdlist = [cmd]
|
||||||
cmdlist.append('-l')
|
cmdlist.append('-l')
|
||||||
|
|
|
@ -15,7 +15,7 @@
|
||||||
# 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 zip program."""
|
"""Archive commands for the zip program."""
|
||||||
|
|
||||||
def create_zip (archive, encoding, cmd, *args, **kwargs):
|
def create_zip (archive, compression, cmd, *args, **kwargs):
|
||||||
"""Create a ZIP archive."""
|
"""Create a ZIP archive."""
|
||||||
cmdlist = [cmd, '-r']
|
cmdlist = [cmd, '-r']
|
||||||
if kwargs['verbose']:
|
if kwargs['verbose']:
|
||||||
|
|
|
@ -16,7 +16,7 @@
|
||||||
"""Archive commands for the zoo program."""
|
"""Archive commands for the zoo program."""
|
||||||
import os
|
import os
|
||||||
|
|
||||||
def extract_zoo (archive, encoding, cmd, **kwargs):
|
def extract_zoo (archive, compression, cmd, **kwargs):
|
||||||
"""Extract a ZOO archive."""
|
"""Extract a ZOO archive."""
|
||||||
# Since extracted files will be placed in the current directory,
|
# Since extracted files will be placed in the current directory,
|
||||||
# the cwd argument has to be the output directory.
|
# the cwd argument has to be the output directory.
|
||||||
|
@ -24,17 +24,17 @@ def extract_zoo (archive, encoding, cmd, **kwargs):
|
||||||
return (cmdlist, {'cwd': kwargs['outdir']})
|
return (cmdlist, {'cwd': kwargs['outdir']})
|
||||||
|
|
||||||
|
|
||||||
def list_zoo (archive, encoding, cmd, **kwargs):
|
def list_zoo (archive, compression, cmd, **kwargs):
|
||||||
"""List a ZOO archive."""
|
"""List a ZOO archive."""
|
||||||
return [cmd, '-list', archive]
|
return [cmd, '-list', archive]
|
||||||
|
|
||||||
|
|
||||||
def test_zoo (archive, encoding, cmd, **kwargs):
|
def test_zoo (archive, compression, cmd, **kwargs):
|
||||||
"""Test a ZOO archive."""
|
"""Test a ZOO archive."""
|
||||||
return [cmd, '-test', archive]
|
return [cmd, '-test', archive]
|
||||||
|
|
||||||
|
|
||||||
def create_zoo (archive, encoding, cmd, *args, **kwargs):
|
def create_zoo (archive, compression, cmd, *args, **kwargs):
|
||||||
"""Create a ZOO archive."""
|
"""Create a ZOO archive."""
|
||||||
cmdlist = [cmd, '-add', archive]
|
cmdlist = [cmd, '-add', archive]
|
||||||
cmdlist.extend(args)
|
cmdlist.extend(args)
|
||||||
|
|
|
@ -143,8 +143,8 @@ def guess_mime_mimedb (filename):
|
||||||
@return: tuple (mime, encoding)
|
@return: tuple (mime, encoding)
|
||||||
"""
|
"""
|
||||||
mime, encoding = mimedb.guess_type(filename, strict=False)
|
mime, encoding = mimedb.guess_type(filename, strict=False)
|
||||||
from patoolib import ArchiveMimetypes, ArchiveEncodings
|
from patoolib import ArchiveMimetypes, ArchiveCompressions
|
||||||
if mime not in ArchiveMimetypes and encoding in ArchiveEncodings:
|
if mime not in ArchiveMimetypes and encoding in ArchiveCompressions:
|
||||||
# Files like 't.txt.gz' are recognized with encoding as format, and
|
# Files like 't.txt.gz' are recognized with encoding as format, and
|
||||||
# an unsupported mime-type like 'text/plain'. Fix this.
|
# an unsupported mime-type like 'text/plain'. Fix this.
|
||||||
mime = Encoding2Mime[encoding]
|
mime = Encoding2Mime[encoding]
|
||||||
|
|
|
@ -174,4 +174,4 @@ def has_codec (program, codec):
|
||||||
"""Test if program supports given codec."""
|
"""Test if program supports given codec."""
|
||||||
if program == '7z' and codec == 'rar':
|
if program == '7z' and codec == 'rar':
|
||||||
return patoolib.util.p7zip_supports_rar()
|
return patoolib.util.p7zip_supports_rar()
|
||||||
return patoolib.find_encoding_program(program, codec)
|
return patoolib.find_compression_program(program, codec)
|
||||||
|
|
|
@ -32,12 +32,12 @@ class TestConfiguration (unittest.TestCase):
|
||||||
if command is not None:
|
if command is not None:
|
||||||
self.assertTrue(command in patoolib.ArchiveCommands)
|
self.assertTrue(command in patoolib.ArchiveCommands)
|
||||||
|
|
||||||
def test_encoding_programs (self):
|
def test_compression_programs (self):
|
||||||
self.assertEqual(set(patoolib.ArchiveEncodings),
|
self.assertEqual(set(patoolib.ArchiveCompressions),
|
||||||
set(patoolib.EncodingPrograms.keys()))
|
set(patoolib.CompressionPrograms.keys()))
|
||||||
|
|
||||||
def test_encoding_mimes (self):
|
def test_encoding_mimes (self):
|
||||||
self.assertEqual(set(patoolib.ArchiveEncodings),
|
self.assertEqual(set(patoolib.ArchiveCompressions),
|
||||||
set(patoolib.util.Encoding2Mime.keys()))
|
set(patoolib.util.Encoding2Mime.keys()))
|
||||||
for mime in patoolib.util.Encoding2Mime.values():
|
for mime in patoolib.util.Encoding2Mime.values():
|
||||||
self.assertTrue(mime in patoolib.ArchiveMimetypes)
|
self.assertTrue(mime in patoolib.ArchiveMimetypes)
|
||||||
|
|
Loading…
Reference in New Issue