From 1cb76a9633321ae88c2ad4855321ebbebffb2e68 Mon Sep 17 00:00:00 2001 From: Bastian Kleineidam Date: Fri, 11 May 2012 07:08:50 +0200 Subject: [PATCH] Support plbzip2. --- doc/changelog.txt | 1 + patoolib/__init__.py | 8 ++++---- patoolib/programs/lbzip2.py | 18 ++++++++++++++++++ tests/test_archives.py | 7 +++++++ tests/test_foo_archives.py | 8 ++++++++ 5 files changed, 38 insertions(+), 4 deletions(-) create mode 100644 patoolib/programs/lbzip2.py diff --git a/doc/changelog.txt b/doc/changelog.txt index f9f36c6..7c00632 100644 --- a/doc/changelog.txt +++ b/doc/changelog.txt @@ -6,6 +6,7 @@ Closes: SF bug #3351936 * Fix generating an RPM installer. Closes: SF bug #2977749 +* Added support for the lbzip2 program handling BZIP2 archives. 0.15 "Contraband" (released 8.4.2012) diff --git a/patoolib/__init__.py b/patoolib/__init__.py index 15a94df..351601c 100644 --- a/patoolib/__init__.py +++ b/patoolib/__init__.py @@ -69,7 +69,7 @@ ArchiveMimetypes = { EncodingPrograms = { 'gzip': ('pigz', 'gzip'), - 'bzip2': ('pbzip2', 'bzip2'), + 'bzip2': ('pbzip2', 'lbzip2', 'bzip2'), 'compress': ('compress',), 'lzma': ('lzma',), 'xz': ('xz',), @@ -99,9 +99,9 @@ ArchivePrograms = { 'list': ('nomarch',), }, 'bzip2': { - 'extract': ('pbzip2', 'bzip2', '7z', '7za'), - 'test': ('pbzip2', 'bzip2', '7z', '7za'), - 'create': ('pbzip2', 'bzip2', '7z', '7za'), + 'extract': ('pbzip2', 'lbzip2', 'bzip2', '7z', '7za'), + 'test': ('pbzip2', 'lbzip2', 'bzip2', '7z', '7za'), + 'create': ('pbzip2', 'lbzip2', 'bzip2', '7z', '7za'), 'list': ('7z', '7za', 'echo',), }, 'tar': { diff --git a/patoolib/programs/lbzip2.py b/patoolib/programs/lbzip2.py new file mode 100644 index 0000000..f1f3fd1 --- /dev/null +++ b/patoolib/programs/lbzip2.py @@ -0,0 +1,18 @@ +# -*- 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 pbzip2 program.""" +# bzip2 and lbzip2 are compatible +from patoolib.programs.bzip2 import extract_bzip2, test_bzip2, create_bzip2 diff --git a/tests/test_archives.py b/tests/test_archives.py index 26c4c3a..77846ef 100644 --- a/tests/test_archives.py +++ b/tests/test_archives.py @@ -110,6 +110,13 @@ class TestArchives (ArchiveTest): self.archive_test('t .bz2') self.archive_create('t .bz2', singlefile=True) + @needs_program('lbzip2') + def test_lbzip2 (self): + self.program = 'lbzip2' + self.archive_extract('t .bz2') + self.archive_test('t .bz2') + self.archive_create('t .bz2', singlefile=True) + @needs_program('echo') def test_echo (self): self.program = 'echo' diff --git a/tests/test_foo_archives.py b/tests/test_foo_archives.py index 3e48399..8e3443b 100644 --- a/tests/test_foo_archives.py +++ b/tests/test_foo_archives.py @@ -128,6 +128,14 @@ class TestArchives (ArchiveTest): self.archive_test('t.bz2.foo') self.archive_create('t.bz2.foo', format="bzip2", singlefile=True) + @needs_program('file') + @needs_program('lbzip2') + def test_lbzip2 (self): + self.program = 'lbzip2' + self.archive_extract('t.bz2.foo') + self.archive_test('t.bz2.foo') + self.archive_create('t.bz2.foo', format="bzip2", singlefile=True) + @needs_program('file') @needs_program('echo') def test_echo (self):