diff --git a/doc/changelog.txt b/doc/changelog.txt index 1070083..08cf343 100644 --- a/doc/changelog.txt +++ b/doc/changelog.txt @@ -4,6 +4,8 @@ * Added correct cpio MIME type on Debian systems. * Added support for the clzip and pdlzip programs who are both capable of handling LZIP (.lz) archives. + * Added support for the orange program which is capable of extracting + CAB (.cab) archives. * Support ZIP (.zip) file creation with the 7z and 7za programs. * Improved MIME type detection for compressed TAR archives. * Fix needed archive programs for several test cases, including diff --git a/patoolib/__init__.py b/patoolib/__init__.py index fd7188c..111774c 100644 --- a/patoolib/__init__.py +++ b/patoolib/__init__.py @@ -146,7 +146,7 @@ ArchivePrograms = { 'test': ('unrar', '7z'), }, 'cab': { - 'extract': ('cabextract', '7z'), + 'extract': ('cabextract', '7z', 'orange'), 'list': ('cabextract', '7z'), 'test': ('cabextract', '7z'), }, diff --git a/patoolib/programs/orange.py b/patoolib/programs/orange.py new file mode 100644 index 0000000..8285734 --- /dev/null +++ b/patoolib/programs/orange.py @@ -0,0 +1,26 @@ +# -*- 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 orange program.""" + +def extract_cab (archive, encoding, cmd, **kwargs): + """Extract a CAB archive.""" + cmdlist = [cmd, '-d', kwargs['outdir']] + if kwargs['verbose']: + cmdlist.append('-D 2') + else: + cmdlist.append('-D 1') + cmdlist.append(archive) + return cmdlist diff --git a/tests/test_archives.py b/tests/test_archives.py index 8c05454..eae64f8 100644 --- a/tests/test_archives.py +++ b/tests/test_archives.py @@ -244,6 +244,11 @@ class TestArchives (ArchiveTest): self.archive_list('t.cab') self.archive_extract('t.cab') + @needs_program('orange') + def test_cabextract (self): + self.program = 'orange' + self.archive_extract('t.cab') + @needs_program('arj') def test_arj (self): self.program = 'arj' diff --git a/tests/test_foo_archives.py b/tests/test_foo_archives.py index 093e5e5..3905943 100644 --- a/tests/test_foo_archives.py +++ b/tests/test_foo_archives.py @@ -272,6 +272,12 @@ class TestArchives (ArchiveTest): self.archive_list('t.cab.foo') self.archive_extract('t.cab.foo') + @needs_program('file') + @needs_program('orange') + def test_cabextract (self): + self.program = 'orange' + self.archive_extract('t.cab.foo') + @needs_program('file') @needs_program('arj') def test_arj (self):