Added support for ZOO (.zoo) archives.
This commit is contained in:
parent
29598b32ea
commit
554d273b08
|
@ -3,6 +3,7 @@
|
|||
* Do not use the diff -B option when comparing archives.
|
||||
* Improved documentation: explain commands in more detail.
|
||||
* Added support for RZIP (.rz) archives.
|
||||
* Added support for ZOO (.zoo) archives.
|
||||
|
||||
0.8 "Storage" (released 11.3.2010)
|
||||
|
||||
|
|
|
@ -32,8 +32,8 @@ by the archive file extension.
|
|||
ARC (.arc), ARJ (.arj),
|
||||
BZIP2 (.bz2), CAB (.cab), compress (.Z), CPIO (.cpio), DEB (.deb), GZIP (.gz),
|
||||
LRZIP (.lrz), LZH (.lha, .lzh), LZIP (.lz), LZMA (.lzma), LZOP (.lzo),
|
||||
RPM (.rpm), RAR (.rar), RZIP (.rz), TAR (.tar), XZ (.xz) and ZIP (.zip, .jar)
|
||||
formats.
|
||||
RPM (.rpm), RAR (.rar), RZIP (.rz), TAR (.tar), XZ (.xz), ZIP (.zip, .jar) and
|
||||
ZOO (.zoo) formats.
|
||||
It relies on helper applications to handle those archive formats
|
||||
(for example bzip2 for BZIP2 archives).
|
||||
.SH EXAMPLES
|
||||
|
|
|
@ -24,7 +24,7 @@ ArchiveCommands = ('list', 'extract', 'test', 'create')
|
|||
# Supported archive formats
|
||||
ArchiveFormats = ('7z', 'ace', 'alzip', 'ar', 'arc', 'arj', 'bzip2',
|
||||
'cab', 'compress', 'cpio', 'deb', 'gzip', 'lrzip', 'lzh', 'lzip', 'lzma',
|
||||
'lzop', 'rar', 'rpm', 'rzip', 'tar', 'xz', 'zip')
|
||||
'lzop', 'rar', 'rpm', 'rzip', 'tar', 'xz', 'zip', 'zoo')
|
||||
|
||||
# Supported encodings (used with tar for example)
|
||||
# Note that all encodings must also be archive formats
|
||||
|
@ -60,6 +60,7 @@ ArchiveMimetypes = {
|
|||
'application/x-arc': 'arc',
|
||||
'application/x-lrzip': 'lrzip',
|
||||
'application/x-rzip': 'rzip',
|
||||
'application/x-zoo': 'zoo',
|
||||
}
|
||||
|
||||
# List of programs supporting the given encoding
|
||||
|
@ -190,6 +191,9 @@ ArchivePrograms = {
|
|||
'test': ('xz',),
|
||||
'create': ('xz',),
|
||||
},
|
||||
'zoo': {
|
||||
None: ('zoo',),
|
||||
},
|
||||
}
|
||||
|
||||
# only list those programs that have different python module names
|
||||
|
|
|
@ -0,0 +1,41 @@
|
|||
# -*- 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 zoo program."""
|
||||
import os
|
||||
|
||||
def extract_zoo (archive, encoding, cmd, **kwargs):
|
||||
"""Extract a ZOO archive."""
|
||||
# Since extracted files will be placed in the current directory,
|
||||
# the cwd argument has to be the output directory.
|
||||
cmdlist = [cmd, '-extract', os.path.abspath(archive)]
|
||||
return (cmdlist, {'cwd': kwargs['outdir']})
|
||||
|
||||
|
||||
def list_zoo (archive, encoding, cmd, **kwargs):
|
||||
"""List a ZOO archive."""
|
||||
return [cmd, '-list', archive]
|
||||
|
||||
|
||||
def test_zoo (archive, encoding, cmd, **kwargs):
|
||||
"""Test a ZOO archive."""
|
||||
return [cmd, '-test', archive]
|
||||
|
||||
|
||||
def create_zoo (archive, encoding, cmd, *args, **kwargs):
|
||||
"""Create a ZOO archive."""
|
||||
cmdlist = [cmd, '-add', archive]
|
||||
cmdlist.extend(args)
|
||||
return cmdlist
|
|
@ -48,6 +48,7 @@ mimedb.add_type('application/x-lrzip', '.lrz', strict=False)
|
|||
mimedb.add_type('application/x-lha', '.lha', strict=False)
|
||||
mimedb.add_type('application/x-lzh', '.lzh', strict=False)
|
||||
mimedb.add_type('application/x-rzip', '.rz', strict=False)
|
||||
mimedb.add_type('application/x-zoo', '.zoo', strict=False)
|
||||
|
||||
|
||||
class PatoolError (StandardError):
|
||||
|
@ -210,6 +211,7 @@ FileText2Mime = {
|
|||
"current ar archive": "application/x-archive",
|
||||
"LHa ": "application/x-lha",
|
||||
"ARC archive data": "application/x-arc",
|
||||
"Zoo archive data": "application/x-zoo",
|
||||
}
|
||||
|
||||
def guess_mime_file_text (file_prog, filename):
|
||||
|
|
5
setup.py
5
setup.py
|
@ -50,8 +50,9 @@ patool supports 7z (.7z), ACE (.ace), ALZIP (.alz), AR (.a), ARC (.arc),
|
|||
ARJ (.arj), BZIP2 (.bz2), CAB (.cab), compress (.Z), CPIO (.cpio),
|
||||
DEB (.deb), GZIP (.gz), LRZIP (.lrz), LZH (.lha, .lzh), LZIP (.lz),
|
||||
LZMA (.lzma), LZOP (.lzo), RPM (.rpm), RAR (.rar), RZIP (.rz), 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).""",
|
||||
XZ (.xz), ZIP (.zip, .jar) and ZOO (.zoo) formats. It relies on helper
|
||||
applications to handle those archive formats (for example bzip2 for
|
||||
BZIP2 archives).""",
|
||||
author = MyName,
|
||||
author_email = MyEmail,
|
||||
maintainer = MyName,
|
||||
|
|
Binary file not shown.
Binary file not shown.
|
@ -318,3 +318,8 @@ class TestArchives (ArchiveTest):
|
|||
self.program = 'rzip'
|
||||
self.archive_extract('t.txt.rz')
|
||||
self.archive_create('t.txt.rz', singlefile=True)
|
||||
|
||||
@needs_program('zoo')
|
||||
def test_zoo (self):
|
||||
self.program = 'zoo'
|
||||
self.archive_commands('t.zoo', singlefile=True)
|
||||
|
|
|
@ -362,3 +362,8 @@ class TestArchives (ArchiveTest):
|
|||
self.program = 'rzip'
|
||||
self.archive_extract('t.txt.rz.foo')
|
||||
self.archive_create('t.txt.rz.foo', format="rzip", singlefile=True)
|
||||
|
||||
@needs_program('zoo')
|
||||
def test_zoo (self):
|
||||
self.program = 'zoo'
|
||||
self.archive_commands('t.zoo.foo', format="zoo", singlefile=True)
|
||||
|
|
|
@ -120,6 +120,8 @@ class TestMime (unittest.TestCase):
|
|||
#self.mime_test_file("t.txt.lrz.foo", "application/x-lrzip", None)
|
||||
self.mime_test_file("t.txt.rz", "application/x-rzip", None)
|
||||
self.mime_test_file("t.txt.rz.foo", "application/x-rzip", None)
|
||||
self.mime_test_file("t.zoo", "application/x-zoo", None)
|
||||
self.mime_test_file("t.zoo.foo", "application/x-zoo", None)
|
||||
|
||||
def test_mime_mimedb (self):
|
||||
self.mime_test_mimedb("t.7z", "application/x-7z-compressed", None)
|
||||
|
@ -157,3 +159,4 @@ class TestMime (unittest.TestCase):
|
|||
self.mime_test_mimedb("t.arc", "application/x-arc", None)
|
||||
self.mime_test_mimedb("t.lrz", "application/x-lrzip", None)
|
||||
self.mime_test_mimedb("t.rz", "application/x-rzip", None)
|
||||
self.mime_test_mimedb("t.zoo", "application/x-zoo", None)
|
||||
|
|
Loading…
Reference in New Issue