diff --git a/doc/changelog.txt b/doc/changelog.txt index 0e9ac32..607d5dd 100644 --- a/doc/changelog.txt +++ b/doc/changelog.txt @@ -7,6 +7,7 @@ * Added support for lhasa handling LZH (.lzh, .lha) archives. * Added support for lcap handling CAB (.cab) archives. * Added support for shar handling SHAR (.shar) shell archives. +* Added support for unadf handling ADF (.adf) amiga disk archives. * Generate standalone Windows .exe and Linux .rpm installer. * Initialize the internal MIME database correct on all platforms. * Improved option compatibility for the ar, cpio and tar programs. diff --git a/doc/patool.1 b/doc/patool.1 index 3282931..b1334c6 100644 --- a/doc/patool.1 +++ b/doc/patool.1 @@ -29,8 +29,8 @@ 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), ALZIP (.alz), APE (.ape), AR (.a), -ARC (.arc), ARJ (.arj), +\fBpatool\fP supports 7z (.7z), ACE (.ace), ADF (.adf), ALZIP (.alz), +APE (.ape), AR (.a), ARC (.arc), ARJ (.arj), BZIP2 (.bz2), CAB (.cab), compress (.Z), CPIO (.cpio), DEB (.deb), DMS (.dms), FLAC (.flac), GZIP (.gz), LRZIP (.lrz), LZH (.lha, .lzh), LZIP (.lz), LZMA (.lzma), LZOP (.lzo), RPM (.rpm), RAR (.rar), RZIP (.rz), SHN (.shn), diff --git a/patoolib/__init__.py b/patoolib/__init__.py index 906c5f6..91b9126 100644 --- a/patoolib/__init__.py +++ b/patoolib/__init__.py @@ -25,9 +25,12 @@ from . import util ArchiveCommands = ('list', 'extract', 'test', 'create') # Supported archive formats -ArchiveFormats = ('7z', 'ace', 'alzip', 'ape', 'ar', 'arc', 'arj', 'bzip2', - 'cab', 'compress', 'cpio', 'deb', 'dms', 'flac', 'gzip', 'lrzip', 'lzh', - 'lzip', 'lzma', 'lzop', 'rar', 'rpm', 'rzip', 'shar', 'shn', 'tar', 'xz', +ArchiveFormats = ( + '7z', 'ace', 'adf', 'alzip', 'ape', 'ar', 'arc', 'arj', + 'bzip2', 'cab', 'compress', 'cpio', 'deb', 'dms', + 'flac', 'gzip', + 'lrzip', 'lzh', 'lzip', 'lzma', 'lzop', + 'rar', 'rpm', 'rzip', 'shar', 'shn', 'tar', 'xz', 'zip', 'zoo') # Supported compressions (used with tar for example) @@ -36,6 +39,7 @@ ArchiveCompressions = ('bzip2', 'compress', 'gzip', 'lzip', 'lzma', 'xz') # Map MIME types to archive format ArchiveMimetypes = { + 'application/x-adf': 'adf', 'application/x-bzip2': 'bzip2', 'application/x-tar': 'tar', 'application/x-gzip': 'gzip', @@ -82,6 +86,11 @@ ArchivePrograms = { 'test': ('unace',), 'list': ('unace',), }, + 'adf': { + 'extract': ('unadf',), + 'test': ('unadf',), + 'list': ('unadf',), + }, 'alzip': { 'extract': ('unalz',), 'test': ('unalz',), diff --git a/patoolib/programs/unadf.py b/patoolib/programs/unadf.py new file mode 100644 index 0000000..26621b2 --- /dev/null +++ b/patoolib/programs/unadf.py @@ -0,0 +1,29 @@ +# -*- coding: utf-8 -*- +# Copyright (C) 2012 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 unadf program.""" +from .. import util + + +def extract_adf (archive, compression, cmd, **kwargs): + """Extract an ADF archive.""" + return [cmd, archive, '-d', kwargs['outdir']] + + +def list_adf (archive, compression, cmd, **kwargs): + """List an ADF archive.""" + return [cmd, '-r', archive] + +test_adf = list_adf diff --git a/patoolib/util.py b/patoolib/util.py index c6c64d1..775eefa 100644 --- a/patoolib/util.py +++ b/patoolib/util.py @@ -44,6 +44,7 @@ def add_mimedb_data(mimedb): mimedb.encodings_map['.lz'] = 'lzip' mimedb.suffix_map['.tbz2'] = '.tar.bz2' add_mimetype(mimedb, 'application/x-lzop', '.lzo') + add_mimetype(mimedb, 'application/x-adf', '.adf') add_mimetype(mimedb, 'application/x-arj', '.arj') add_mimetype(mimedb, 'application/x-lzma', '.lzma') add_mimetype(mimedb, 'application/x-xz', '.xz') @@ -248,6 +249,7 @@ def get_file_mime_encoding (parts): FileText2Mime = { "7-zip archive data": "application/x-7z-compressed", "ACE archive data": "application/x-ace", + "Amiga DOS disk": "application/x-adf", "ARJ archive data": "application/x-arj", "bzip2 compressed data": "application/x-bzip2", "cpio archive": "application/x-cpio", diff --git a/setup.py b/setup.py index 3d02927..e555393 100644 --- a/setup.py +++ b/setup.py @@ -251,8 +251,9 @@ 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. -patool supports 7z (.7z), ACE (.ace), ALZIP (.alz), APE (.ape), AR (.a), -ARC (.arc), ARJ (.arj), BZIP2 (.bz2), CAB (.cab), compress (.Z), CPIO (.cpio), +patool supports 7z (.7z), ACE (.ace), ADF (.adf), ALZIP (.alz), APE (.ape), +AR (.a), ARC (.arc), ARJ (.arj), BZIP2 (.bz2), +CAB (.cab), compress (.Z), CPIO (.cpio), DEB (.deb), DMS (.dms), FLAC (.flac), GZIP (.gz), LRZIP (.lrz), LZH (.lha, .lzh), LZIP (.lz), LZMA (.lzma), LZOP (.lzo), RPM (.rpm), RAR (.rar), RZIP (.rz), SHN (.shn), TAR (.tar), XZ (.xz), ZIP (.zip, .jar) diff --git a/tests/data/t.adf b/tests/data/t.adf new file mode 100644 index 0000000..937b0d7 Binary files /dev/null and b/tests/data/t.adf differ diff --git a/tests/data/t.adf.foo b/tests/data/t.adf.foo new file mode 100644 index 0000000..937b0d7 Binary files /dev/null and b/tests/data/t.adf.foo differ diff --git a/tests/test_archives.py b/tests/test_archives.py index 59398a9..043bc0e 100644 --- a/tests/test_archives.py +++ b/tests/test_archives.py @@ -491,9 +491,16 @@ class TestArchives (ArchiveTest): @needs_program('xdms') def test_xdms (self): self.program = 'xdms' - self.archive_test('t.dms') self.archive_extract('t.dms') self.archive_list('t.dms') + self.archive_test('t.dms') + + @needs_program('unadf') + def test_unadf (self): + self.program = 'unadf' + self.archive_extract('t.adf', check=None) + self.archive_list('t.adf') + self.archive_test('t.adf') @needs_program('mac') def test_mac (self): diff --git a/tests/test_foo_archives.py b/tests/test_foo_archives.py index 018fa33..d8d4d07 100644 --- a/tests/test_foo_archives.py +++ b/tests/test_foo_archives.py @@ -518,6 +518,13 @@ class TestArchives (ArchiveTest): # self.archive_test('t.dms.foo') # self.archive_list('t.dms.foo') + @needs_program('unadf') + def test_unadf (self): + self.program = 'unadf' + self.archive_extract('t.adf.foo', check=None) + self.archive_test('t.adf.foo') + self.archive_list('t.adf.foo') + @needs_program('file') @needs_program('mac') def test_mac (self): diff --git a/tests/test_mime.py b/tests/test_mime.py index 6bcfe88..661f410 100644 --- a/tests/test_mime.py +++ b/tests/test_mime.py @@ -123,6 +123,8 @@ class TestMime (unittest.TestCase): #self.mime_test_file("t.shn.foo", "audio/x-shn", None) self.mime_test_file("t.flac", "audio/flac", None) self.mime_test_file("t.flac.foo", "audio/flac", None) + self.mime_test_file("t.adf", "application/x-adf", None) + self.mime_test_file("t.adf.foo", "application/x-adf", None) @needs_program('file') @needs_program('lzip') @@ -194,3 +196,4 @@ class TestMime (unittest.TestCase): self.mime_test_mimedb("t.ape", "audio/x-ape", None) self.mime_test_mimedb("t.shn", "audio/x-shn", None) self.mime_test_mimedb("t.flac", "audio/flac", None) + self.mime_test_mimedb("t.adf", "application/x-adf", None)