Support ADF (.adf) Amiga disk file archives.

This commit is contained in:
Bastian Kleineidam 2012-08-03 22:26:40 +02:00
parent af9b803466
commit be7d473b9e
11 changed files with 67 additions and 8 deletions

View File

@ -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.

View File

@ -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),

View File

@ -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',),

View File

@ -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 <http://www.gnu.org/licenses/>.
"""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

View File

@ -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",

View File

@ -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)

BIN
tests/data/t.adf Normal file

Binary file not shown.

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

Binary file not shown.

View File

@ -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):

View File

@ -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):

View File

@ -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)