Added support for ALZIP (.alz) archives.

This commit is contained in:
Bastian Kleineidam 2010-03-06 21:35:03 +01:00
parent 4bda02dd9c
commit acbf544d04
11 changed files with 66 additions and 13 deletions

View File

@ -1,6 +1,6 @@
0.7 "" (released xx.xx.xxxx)
*
* Added support for ALZIP (.alz) archives.
0.6 "Waking Ned" (released 6.3.2010)

View File

@ -26,11 +26,10 @@ 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
by the archive file extension.
.PP
\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),
RPM (.rpm), DEB (.deb), LZH (.lha, .lzh), LZIP (.lz), LZOP (.lzo),
LZMA (.lzma), RAR (.rar) and XZ (.xz) formats.
\fBpatool\fP supports 7z (.7z), ACE (.ace), ALZIP (.alz), AR (.a), ARJ (.arj),
BZIP2 (.bz2), CAB (.cab), compress (.Z), CPIO (.cpio), DEB (.deb), GZIP (.gz),
LZH (.lha, .lzh), LZIP (.lz), LZMA (.lzma), LZOP (.lzo), RPM (.rpm),
RAR (.rar), TAR (.tar), XZ (.xz) and ZIP (.zip, .jar) formats.
It relies on helper applications to handle those archive formats
(for example bzip2 for BZIP2 archives).
.SH EXAMPLES

View File

@ -18,12 +18,12 @@ DESCRIPTION
The archive format is determined by the file(1) program and as a fall
back by the archive file extension.
patool supports 7z (.7z), ACE (.ace), AR (.a), ZIP (.zip, .jar), GZIP
(.gz), compress (.Z), BZIP2 (.bz2), TAR (.tar), ARJ (.arj), CAB (.cab),
CPIO (.cpio), RPM (.rpm), DEB (.deb), LZIP (.lz), LZOP (.lzo), LZMA
(.lzma), RAR (.rar) and XZ (.xz) formats. It relies on helper applica
tions to handle those archive formats (for example bzip2 for BZIP2 ar
chives).
patool supports 7z (.7z), ACE (.ace), ALZIP (.alz), AR (.a), ARJ
(.arj), BZIP2 (.bz2), CAB (.cab), compress (.Z), CPIO (.cpio), DEB
(.deb), GZIP (.gz), LZH (.lha, .lzh), LZIP (.lz), LZMA (.lzma), LZOP
(.lzo), RPM (.rpm), RAR (.rar), TAR (.tar), XZ (.xz) and ZIP (.zip,
.jar) formats. It relies on helper applications to handle those ar
chive formats (for example bzip2 for BZIP2 archives).
EXAMPLES
patool extract archive.zip otherarchive.rar

View File

@ -24,7 +24,7 @@ ArchiveCommands = ('list', 'extract', 'test', 'create')
# Supported archive formats
ArchiveFormats = ('gzip', 'bzip2', 'tar', 'zip', 'compress', '7z', 'rar',
'cab', 'arj', 'cpio', 'rpm', 'deb', 'lzop', 'lzma', 'xz', 'lzip', 'ace',
'ar', 'lzh')
'ar', 'lzh', 'alzip')
# Supported encodings (used with tar for example)
# Note that all encodings must also be archive formats
@ -56,6 +56,7 @@ ArchiveMimetypes = {
'application/x-archive': 'ar',
'application/x-lha': 'lzh',
'application/x-lzh': 'lzh',
'application/x-alzip': 'alzip',
}
# List of programs supporting the given encoding
@ -77,6 +78,11 @@ ArchivePrograms = {
'test': ('unace',),
'list': ('unace',),
},
'alzip': {
'extract': ('unalz',),
'test': ('unalz',),
'list': ('unalz',),
},
'ar': {
None: ('ar',),
},

View File

@ -0,0 +1,27 @@
# -*- 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 unalz program."""
def extract_alzip (archive, encoding, cmd, **kwargs):
"""Extract a ALZIP archive."""
return [cmd, '-d', kwargs['outdir'], archive]
def list_alzip (archive, encoding, cmd, **kwargs):
"""List a ALZIP archive."""
return [cmd, '-l', archive]
test_alzip = list_alzip

View File

@ -42,6 +42,7 @@ mimedb.add_type('application/x-debian-package', '.deb', strict=False)
mimedb.add_type('application/x-ace', '.ace', strict=False)
# Since .a is already a common type, strict=True must be used.
mimedb.add_type('application/x-archive', '.a', strict=True)
mimedb.add_type('application/x-alzip', '.alz', strict=False)
class PatoolError (StandardError):

BIN
tests/data/t.alz Normal file

Binary file not shown.

BIN
tests/data/t.alz.foo Normal file

Binary file not shown.

View File

@ -272,6 +272,13 @@ class TestArchives (ArchiveTest):
self.archive_extract('t.txt.lz')
self.archive_create('t.txt.lz', singlefile=True)
@needs_program('unalz')
def test_unalz (self):
self.program = 'unalz'
self.archive_test('t.alz')
self.archive_list('t.alz')
self.archive_extract('t.alz')
@needs_program('xz')
def test_xz (self):
self.program = 'xz'

View File

@ -326,3 +326,12 @@ class TestArchives (ArchiveTest):
def test_lha (self):
self.program = 'lha'
self.archive_commands('t.lha.foo', format="lzh")
# file(1) does not recognize .alz files
#@needs_program('file')
#@needs_program('unalz')
#def test_unalz (self):
# self.program = 'unalz'
# self.archive_test('t.alz.foo')
# self.archive_list('t.alz.foo')
# self.archive_extract('t.alz.foo')

View File

@ -106,6 +106,9 @@ class TestMime (unittest.TestCase):
self.mime_test_file("t.lha", "application/x-lha", None)
self.mime_test_file("t.lzh", "application/x-lha", None)
self.mime_test_file("t.lha.foo", "application/x-lha", None)
# file(1) does not recognize .alz files
#self.mime_test_mimedb("t.alz", "application/x-alzip", None)
#self.mime_test_mimedb("t.alz.foo", "application/x-alzip", None)
def test_mime_mimedb (self):
@ -140,3 +143,4 @@ class TestMime (unittest.TestCase):
self.mime_test_mimedb("t.a", "application/x-archive", None)
self.mime_test_mimedb("t.lha", "application/x-lha", None)
self.mime_test_mimedb("t.lzh", "application/x-lzh", None)
self.mime_test_mimedb("t.alz", "application/x-alzip", None)