Added support for LZH (.lha, .lzh) archives.
This commit is contained in:
parent
f6720231dd
commit
3e76a655bd
|
@ -8,6 +8,7 @@
|
||||||
current user.
|
current user.
|
||||||
* Added support for ACE (.ace) archives.
|
* Added support for ACE (.ace) archives.
|
||||||
* Added support for AR (.a) archives.
|
* Added support for AR (.a) archives.
|
||||||
|
* Added support for LZH (.lha, .lzh) archives.
|
||||||
|
|
||||||
0.5 "Vanishing Point" (released 4.3.2010)
|
0.5 "Vanishing Point" (released 4.3.2010)
|
||||||
|
|
||||||
|
|
|
@ -26,10 +26,11 @@ files without having to remember a myriad of programs and options.
|
||||||
The archive format is determined by the file(1) program and as a fallback
|
The archive format is determined by the file(1) program and as a fallback
|
||||||
by the archive file extension.
|
by the archive file extension.
|
||||||
.PP
|
.PP
|
||||||
\fBpatool\fP supports 7z (.7z), ACE (.ace), AR (.a), ZIP (.zip, .jar), GZIP (.gz), compress (.Z),
|
\fBpatool\fP supports 7z (.7z), ACE (.ace), AR (.a), ZIP (.zip, .jar),
|
||||||
|
GZIP (.gz), compress (.Z),
|
||||||
BZIP2 (.bz2), TAR (.tar), ARJ (.arj), CAB (.cab), CPIO (.cpio),
|
BZIP2 (.bz2), TAR (.tar), ARJ (.arj), CAB (.cab), CPIO (.cpio),
|
||||||
RPM (.rpm), DEB (.deb), LZIP (.lz), LZOP (.lzo), LZMA (.lzma), RAR (.rar)
|
RPM (.rpm), DEB (.deb), LZH (.lha, .lzh), LZIP (.lz), LZOP (.lzo),
|
||||||
and XZ (.xz) formats.
|
LZMA (.lzma), RAR (.rar) and XZ (.xz) formats.
|
||||||
It relies on helper applications to handle those archive formats
|
It relies on helper applications to handle those archive formats
|
||||||
(for example bzip2 for BZIP2 archives).
|
(for example bzip2 for BZIP2 archives).
|
||||||
.SH EXAMPLES
|
.SH EXAMPLES
|
||||||
|
|
|
@ -1 +0,0 @@
|
||||||
- Support lha archives.
|
|
|
@ -24,7 +24,7 @@ ArchiveCommands = ('list', 'extract', 'test', 'create')
|
||||||
# Supported archive formats
|
# Supported archive formats
|
||||||
ArchiveFormats = ('gzip', 'bzip2', 'tar', 'zip', 'compress', '7z', 'rar',
|
ArchiveFormats = ('gzip', 'bzip2', 'tar', 'zip', 'compress', '7z', 'rar',
|
||||||
'cab', 'arj', 'cpio', 'rpm', 'deb', 'lzop', 'lzma', 'xz', 'lzip', 'ace',
|
'cab', 'arj', 'cpio', 'rpm', 'deb', 'lzop', 'lzma', 'xz', 'lzip', 'ace',
|
||||||
'ar')
|
'ar', 'lzh')
|
||||||
|
|
||||||
# Supported encodings (used with tar for example)
|
# Supported encodings (used with tar for example)
|
||||||
# Note that all encodings must also be archive formats
|
# Note that all encodings must also be archive formats
|
||||||
|
@ -54,6 +54,8 @@ ArchiveMimetypes = {
|
||||||
'application/x-lzip': 'lzip',
|
'application/x-lzip': 'lzip',
|
||||||
'application/x-ace': 'ace',
|
'application/x-ace': 'ace',
|
||||||
'application/x-archive': 'ar',
|
'application/x-archive': 'ar',
|
||||||
|
'application/x-lha': 'lzh',
|
||||||
|
'application/x-lzh': 'lzh',
|
||||||
}
|
}
|
||||||
|
|
||||||
# List of programs supporting the given encoding
|
# List of programs supporting the given encoding
|
||||||
|
@ -96,6 +98,9 @@ ArchivePrograms = {
|
||||||
'gzip': {
|
'gzip': {
|
||||||
None: ('gzip', '7z'),
|
None: ('gzip', '7z'),
|
||||||
},
|
},
|
||||||
|
'lzh': {
|
||||||
|
None: ('lha',),
|
||||||
|
},
|
||||||
'lzip': {
|
'lzip': {
|
||||||
'extract': ('lzip',),
|
'extract': ('lzip',),
|
||||||
'list': ('echo',),
|
'list': ('echo',),
|
||||||
|
|
|
@ -0,0 +1,56 @@
|
||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
# Copyright (C) 2010 Bastian Kleineidam
|
||||||
|
#
|
||||||
|
# This program is free software: you can redistribute it and/or modify
|
||||||
|
# it under the terms of the GNU General Public License as published by
|
||||||
|
# the Free Software Foundation, either version 3 of the License, or
|
||||||
|
# (at your option) any later version.
|
||||||
|
#
|
||||||
|
# This program is distributed in the hope that it will be useful,
|
||||||
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
# GNU General Public License for more details.
|
||||||
|
#
|
||||||
|
# You should have received a copy of the GNU General Public License
|
||||||
|
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
"""Archive commands for the lha program."""
|
||||||
|
|
||||||
|
def extract_lzh (archive, encoding, cmd, **kwargs):
|
||||||
|
"""Extract a LZH archive."""
|
||||||
|
cmdlist = [cmd]
|
||||||
|
opts = 'x'
|
||||||
|
if kwargs['verbose']:
|
||||||
|
opts += 'v'
|
||||||
|
opts += "w=%s" % kwargs['outdir']
|
||||||
|
cmdlist.extend([opts, archive])
|
||||||
|
return cmdlist
|
||||||
|
|
||||||
|
def list_lzh (archive, encoding, cmd, **kwargs):
|
||||||
|
"""List a LZH archive."""
|
||||||
|
cmdlist = [cmd]
|
||||||
|
if kwargs['verbose']:
|
||||||
|
cmdlist.append('v')
|
||||||
|
else:
|
||||||
|
cmdlist.append('l')
|
||||||
|
cmdlist.append(archive)
|
||||||
|
return cmdlist
|
||||||
|
|
||||||
|
def test_lzh (archive, encoding, cmd, **kwargs):
|
||||||
|
"""Test a LZH archive."""
|
||||||
|
cmdlist = [cmd]
|
||||||
|
opts = 't'
|
||||||
|
if kwargs['verbose']:
|
||||||
|
opts += 'v'
|
||||||
|
cmdlist.extend([opts, archive])
|
||||||
|
return cmdlist
|
||||||
|
|
||||||
|
def create_lzh (archive, encoding, cmd, *args, **kwargs):
|
||||||
|
"""Create a LZH archive."""
|
||||||
|
cmdlist = [cmd]
|
||||||
|
opts = 'a'
|
||||||
|
if kwargs['verbose']:
|
||||||
|
opts += 'v'
|
||||||
|
cmdlist.extend([opts, archive])
|
||||||
|
cmdlist.extend(args)
|
||||||
|
return cmdlist
|
||||||
|
|
|
@ -197,6 +197,7 @@ FileText2Mime = {
|
||||||
"compress'd data": "application/x-compress",
|
"compress'd data": "application/x-compress",
|
||||||
"lzip compressed data": "application/x-lzip",
|
"lzip compressed data": "application/x-lzip",
|
||||||
"current ar archive": "application/x-archive",
|
"current ar archive": "application/x-archive",
|
||||||
|
"LHa ": "application/x-lha",
|
||||||
}
|
}
|
||||||
|
|
||||||
def guess_mime_file_text (file_prog, filename):
|
def guess_mime_file_text (file_prog, filename):
|
||||||
|
|
Loading…
Reference in New Issue