From acbf544d047ac0914a0a2586933255e7413ec108 Mon Sep 17 00:00:00 2001 From: Bastian Kleineidam Date: Sat, 6 Mar 2010 21:35:03 +0100 Subject: [PATCH] Added support for ALZIP (.alz) archives. --- doc/changelog.txt | 2 +- doc/patool.1 | 9 ++++----- doc/patool.txt | 12 ++++++------ patoolib/__init__.py | 8 +++++++- patoolib/programs/unalz.py | 27 +++++++++++++++++++++++++++ patoolib/util.py | 1 + tests/data/t.alz | Bin 0 -> 59 bytes tests/data/t.alz.foo | Bin 0 -> 59 bytes tests/test_archives.py | 7 +++++++ tests/test_foo_archives.py | 9 +++++++++ tests/test_mime.py | 4 ++++ 11 files changed, 66 insertions(+), 13 deletions(-) create mode 100644 patoolib/programs/unalz.py create mode 100644 tests/data/t.alz create mode 100644 tests/data/t.alz.foo diff --git a/doc/changelog.txt b/doc/changelog.txt index 7762226..2105d9f 100644 --- a/doc/changelog.txt +++ b/doc/changelog.txt @@ -1,6 +1,6 @@ 0.7 "" (released xx.xx.xxxx) - * + * Added support for ALZIP (.alz) archives. 0.6 "Waking Ned" (released 6.3.2010) diff --git a/doc/patool.1 b/doc/patool.1 index 7615314..12b62e8 100644 --- a/doc/patool.1 +++ b/doc/patool.1 @@ -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 diff --git a/doc/patool.txt b/doc/patool.txt index eb24bd9..daa5fed 100644 --- a/doc/patool.txt +++ b/doc/patool.txt @@ -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 diff --git a/patoolib/__init__.py b/patoolib/__init__.py index 2401be5..8b64ce8 100644 --- a/patoolib/__init__.py +++ b/patoolib/__init__.py @@ -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',), }, diff --git a/patoolib/programs/unalz.py b/patoolib/programs/unalz.py new file mode 100644 index 0000000..dbdcd6a --- /dev/null +++ b/patoolib/programs/unalz.py @@ -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 . +"""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 diff --git a/patoolib/util.py b/patoolib/util.py index ae106f0..ca68f02 100644 --- a/patoolib/util.py +++ b/patoolib/util.py @@ -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): diff --git a/tests/data/t.alz b/tests/data/t.alz new file mode 100644 index 0000000000000000000000000000000000000000..5a8dd1ac5a152c8a7d1ff7add79c0fa5bf0fe933 GIT binary patch literal 59 zcmZ?tiDKkpU|?_p(i{v55v$W|1Q?hY+{I?