Added support for ACE (.ace) archives.
This commit is contained in:
parent
670d5df652
commit
9a04371f07
|
@ -3,9 +3,10 @@
|
||||||
* Remove the --force option. Local files are now never overwritten.
|
* Remove the --force option. Local files are now never overwritten.
|
||||||
* Added option alias -v for --verbose.
|
* Added option alias -v for --verbose.
|
||||||
* Added --verbose option to create command.
|
* Added --verbose option to create command.
|
||||||
* Added support for Extract, list and test multiple archives.
|
* Added support for extracting, listing and testing multiple archives.
|
||||||
* Fix permissions of extracted files: make them readable by the
|
* Fix permissions of extracted files: make them readable by the
|
||||||
current user.
|
current user.
|
||||||
|
* Added support for ACE (.ace) archives.
|
||||||
|
|
||||||
0.5 "Vanishing Point" (released 4.3.2010)
|
0.5 "Vanishing Point" (released 4.3.2010)
|
||||||
|
|
||||||
|
|
|
@ -26,7 +26,7 @@ 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
|
The archive format is determined by the file(1) program and as a fallback
|
||||||
by the archive file extension.
|
by the archive file extension.
|
||||||
.PP
|
.PP
|
||||||
\fBpatool\fP supports 7z (.7z), ZIP (.zip, .jar), GZIP (.gz), compress (.Z),
|
\fBpatool\fP supports 7z (.7z), ACE (.ace), ZIP (.zip, .jar), GZIP (.gz), compress (.Z),
|
||||||
BZIP2 (.bz2), TAR (.tar), ARJ (.arj), CAB (.cab), CPIO (.cpio),
|
BZIP2 (.bz2), TAR (.tar), ARJ (.arj), CAB (.cab), CPIO (.cpio),
|
||||||
RPM (.rpm), DEB (.deb), LZIP (.lz), LZOP (.lzo), LZMA (.lzma), RAR (.rar)
|
RPM (.rpm), DEB (.deb), LZIP (.lz), LZOP (.lzo), LZMA (.lzma), RAR (.rar)
|
||||||
and XZ (.xz) formats.
|
and XZ (.xz) formats.
|
||||||
|
|
|
@ -18,11 +18,11 @@ DESCRIPTION
|
||||||
The archive format is determined by the file(1) program and as a fall‐
|
The archive format is determined by the file(1) program and as a fall‐
|
||||||
back by the archive file extension.
|
back by the archive file extension.
|
||||||
|
|
||||||
patool supports 7z (.7z), ZIP (.zip, .jar), GZIP (.gz), compress (.Z),
|
patool supports 7z (.7z), ACE (.ace), ZIP (.zip, .jar), GZIP (.gz),
|
||||||
BZIP2 (.bz2), TAR (.tar), ARJ (.arj), CAB (.cab), CPIO (.cpio), RPM
|
compress (.Z), BZIP2 (.bz2), TAR (.tar), ARJ (.arj), CAB (.cab), CPIO
|
||||||
(.rpm), DEB (.deb), LZIP (.lz), LZOP (.lzo), LZMA (.lzma), RAR (.rar)
|
(.cpio), RPM (.rpm), DEB (.deb), LZIP (.lz), LZOP (.lzo), LZMA (.lzma),
|
||||||
and XZ (.xz) formats. It relies on helper applications to handle those
|
RAR (.rar) and XZ (.xz) formats. It relies on helper applications to
|
||||||
archive formats (for example bzip2 for BZIP2 archives).
|
handle those archive formats (for example bzip2 for BZIP2 archives).
|
||||||
|
|
||||||
EXAMPLES
|
EXAMPLES
|
||||||
patool extract archive.zip otherarchive.rar
|
patool extract archive.zip otherarchive.rar
|
||||||
|
|
|
@ -1,3 +1,2 @@
|
||||||
- Support ace (unace) archives.
|
|
||||||
- Support ar archives.
|
- Support ar archives.
|
||||||
- Support lha archives.
|
- Support lha archives.
|
||||||
|
|
|
@ -23,7 +23,7 @@ ArchiveCommands = ('list', 'extract', 'test', 'create')
|
||||||
|
|
||||||
# Supported archive formats
|
# Supported archive formats
|
||||||
ArchiveFormats = ('gzip', 'bzip2', 'tar', 'zip', 'compress', '7z', 'rar',
|
ArchiveFormats = ('gzip', 'bzip2', 'tar', 'zip', 'compress', '7z', 'rar',
|
||||||
'cab', 'arj', 'cpio', 'rpm', 'deb', 'lzop', 'lzma', 'xz', 'lzip')
|
'cab', 'arj', 'cpio', 'rpm', 'deb', 'lzop', 'lzma', 'xz', 'lzip', 'ace')
|
||||||
|
|
||||||
# Supported encodings (used with tar for example)
|
# Supported encodings (used with tar for example)
|
||||||
# Note that all encodings must also be archive formats
|
# Note that all encodings must also be archive formats
|
||||||
|
@ -51,6 +51,7 @@ ArchiveMimetypes = {
|
||||||
'application/x-lzma': 'lzma',
|
'application/x-lzma': 'lzma',
|
||||||
'application/x-xz': 'xz',
|
'application/x-xz': 'xz',
|
||||||
'application/x-lzip': 'lzip',
|
'application/x-lzip': 'lzip',
|
||||||
|
'application/x-ace': 'ace',
|
||||||
}
|
}
|
||||||
|
|
||||||
# List of programs supporting the given encoding
|
# List of programs supporting the given encoding
|
||||||
|
@ -67,6 +68,11 @@ EncodingPrograms = {
|
||||||
# List of programs supporting the given archive format and command.
|
# List of programs supporting the given archive format and command.
|
||||||
# If command is None, the program supports all commands (list, extract, ...)
|
# If command is None, the program supports all commands (list, extract, ...)
|
||||||
ArchivePrograms = {
|
ArchivePrograms = {
|
||||||
|
'ace': {
|
||||||
|
'extract': ('unace',),
|
||||||
|
'test': ('unace',),
|
||||||
|
'list': ('unace',),
|
||||||
|
},
|
||||||
'bzip2': {
|
'bzip2': {
|
||||||
'extract': ('pbzip2', 'bzip2', '7z'),
|
'extract': ('pbzip2', 'bzip2', '7z'),
|
||||||
'test': ('pbzip2', 'bzip2', '7z'),
|
'test': ('pbzip2', 'bzip2', '7z'),
|
||||||
|
|
|
@ -0,0 +1,47 @@
|
||||||
|
# -*- 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 unace program."""
|
||||||
|
|
||||||
|
def extract_ace (archive, encoding, cmd, **kwargs):
|
||||||
|
"""Extract a ACE archive."""
|
||||||
|
cmdlist = [cmd]
|
||||||
|
cmdlist.append('x')
|
||||||
|
if not kwargs['verbose']:
|
||||||
|
cmdlist.append('-c-')
|
||||||
|
cmdlist.extend([archive, kwargs['outdir']])
|
||||||
|
return cmdlist
|
||||||
|
|
||||||
|
|
||||||
|
def list_ace (archive, encoding, cmd, **kwargs):
|
||||||
|
"""List a ACE archive."""
|
||||||
|
cmdlist = [cmd]
|
||||||
|
if kwargs['verbose']:
|
||||||
|
cmdlist.append('v')
|
||||||
|
else:
|
||||||
|
cmdlist.append('l')
|
||||||
|
cmdlist.append('-c-')
|
||||||
|
cmdlist.extend([archive])
|
||||||
|
return cmdlist
|
||||||
|
|
||||||
|
|
||||||
|
def test_ace (archive, encoding, cmd, **kwargs):
|
||||||
|
"""Test a ACE archive."""
|
||||||
|
cmdlist = [cmd]
|
||||||
|
cmdlist.append('t')
|
||||||
|
if not kwargs['verbose']:
|
||||||
|
cmdlist.append('-c-')
|
||||||
|
cmdlist.extend([archive])
|
||||||
|
return cmdlist
|
|
@ -39,6 +39,7 @@ mimedb.add_type('application/x-7z-compressed', '.7z', strict=False)
|
||||||
mimedb.add_type('application/x-cab', '.cab', strict=False)
|
mimedb.add_type('application/x-cab', '.cab', strict=False)
|
||||||
mimedb.add_type('application/x-rpm', '.rpm', strict=False)
|
mimedb.add_type('application/x-rpm', '.rpm', strict=False)
|
||||||
mimedb.add_type('application/x-debian-package', '.deb', strict=False)
|
mimedb.add_type('application/x-debian-package', '.deb', strict=False)
|
||||||
|
mimedb.add_type('application/x-ace', '.ace', strict=False)
|
||||||
|
|
||||||
|
|
||||||
class PatoolError (StandardError):
|
class PatoolError (StandardError):
|
||||||
|
@ -174,6 +175,7 @@ def get_file_mime_encoding (parts):
|
||||||
# Match file(1) output text to mime types
|
# Match file(1) output text to mime types
|
||||||
FileText2Mime = {
|
FileText2Mime = {
|
||||||
"7-zip archive data": "application/x-7z-compressed",
|
"7-zip archive data": "application/x-7z-compressed",
|
||||||
|
"ACE archive data": "application/x-ace",
|
||||||
"ARJ archive data": "application/x-arj",
|
"ARJ archive data": "application/x-arj",
|
||||||
"bzip2 compressed data": "application/x-bzip2",
|
"bzip2 compressed data": "application/x-bzip2",
|
||||||
"cpio archive": "application/x-cpio",
|
"cpio archive": "application/x-cpio",
|
||||||
|
|
Binary file not shown.
Binary file not shown.
|
@ -219,6 +219,13 @@ class TestArchives (ArchiveTest):
|
||||||
self.archive_extract('t.cpio')
|
self.archive_extract('t.cpio')
|
||||||
self.archive_create('t.cpio')
|
self.archive_create('t.cpio')
|
||||||
|
|
||||||
|
@needs_program('unace')
|
||||||
|
def test_unace (self):
|
||||||
|
self.program = 'unace'
|
||||||
|
self.archive_list('t.ace')
|
||||||
|
self.archive_test('t.ace')
|
||||||
|
self.archive_extract('t.ace')
|
||||||
|
|
||||||
@needs_program('rpm')
|
@needs_program('rpm')
|
||||||
def test_rpm (self):
|
def test_rpm (self):
|
||||||
self.program = 'rpm'
|
self.program = 'rpm'
|
||||||
|
|
|
@ -251,6 +251,14 @@ class TestArchives (ArchiveTest):
|
||||||
self.archive_extract('t.cpio.foo')
|
self.archive_extract('t.cpio.foo')
|
||||||
self.archive_create('t.cpio.foo', format="cpio")
|
self.archive_create('t.cpio.foo', format="cpio")
|
||||||
|
|
||||||
|
@needs_program('file')
|
||||||
|
@needs_program('unace')
|
||||||
|
def test_unace (self):
|
||||||
|
self.program = 'unace'
|
||||||
|
self.archive_list('t.ace.foo')
|
||||||
|
self.archive_test('t.ace.foo')
|
||||||
|
self.archive_extract('t.ace.foo')
|
||||||
|
|
||||||
@needs_program('file')
|
@needs_program('file')
|
||||||
@needs_program('rpm')
|
@needs_program('rpm')
|
||||||
def test_rpm (self):
|
def test_rpm (self):
|
||||||
|
|
|
@ -86,3 +86,5 @@ class TestMime (unittest.TestCase):
|
||||||
self.mime_test("t.Z.foo", "application/x-compress", None)
|
self.mime_test("t.Z.foo", "application/x-compress", None)
|
||||||
self.mime_test("t.zip", "application/zip", None)
|
self.mime_test("t.zip", "application/zip", None)
|
||||||
self.mime_test("t.zip.foo", "application/zip", None)
|
self.mime_test("t.zip.foo", "application/zip", None)
|
||||||
|
self.mime_test("t.ace", "application/x-ace", None)
|
||||||
|
self.mime_test("t.ace.foo", "application/x-ace", None)
|
||||||
|
|
Loading…
Reference in New Issue