Add lcab support.

This commit is contained in:
Bastian Kleineidam 2012-05-24 23:17:37 +02:00
parent 1b2f0f8a09
commit 216faeaf0e
7 changed files with 46 additions and 5 deletions

View File

@ -5,6 +5,7 @@
* Added support for flac handling FLAC (.flac) files. * Added support for flac handling FLAC (.flac) files.
* Added support for the BSD cpio and tar programs. * Added support for the BSD cpio and tar programs.
* Added support for lhasa handling LZH (.lzh, .lha) files. * Added support for lhasa handling LZH (.lzh, .lha) files.
* Added support for lcap handling CAB (.cab) files.
* Generate standalone Windows .exe and Linux .rpm installer. * Generate standalone Windows .exe and Linux .rpm installer.
* Initialize the internal MIME database correct on all platforms. * Initialize the internal MIME database correct on all platforms.
* Improved option compatibility for the ar, cpio and tar programs. * Improved option compatibility for the ar, cpio and tar programs.

View File

@ -104,6 +104,12 @@ ArchivePrograms = {
'create': ('pbzip2', 'lbzip2', 'bzip2', 'py_bz2'), 'create': ('pbzip2', 'lbzip2', 'bzip2', 'py_bz2'),
'list': ('py_echo', '7z', '7za'), 'list': ('py_echo', '7z', '7za'),
}, },
'cab': {
'extract': ('cabextract', '7z', 'orange'),
'create': ('lcab',),
'list': ('cabextract', '7z'),
'test': ('cabextract', '7z'),
},
'flac': { 'flac': {
'extract': ('flac',), 'extract': ('flac',),
'test': ('flac',), 'test': ('flac',),
@ -156,11 +162,6 @@ ArchivePrograms = {
'list': ('unrar', '7z'), 'list': ('unrar', '7z'),
'test': ('unrar', '7z'), 'test': ('unrar', '7z'),
}, },
'cab': {
'extract': ('cabextract', '7z', 'orange'),
'list': ('cabextract', '7z'),
'test': ('cabextract', '7z'),
},
'arj': { 'arj': {
None: ('arj',), None: ('arj',),
'extract': ('7z',), 'extract': ('7z',),

25
patoolib/programs/lcab.py Normal file
View File

@ -0,0 +1,25 @@
# -*- 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 lcab program."""
def create_cab (archive, compression, cmd, *args, **kwargs):
"""Create a CAB archive."""
cmdlist = [cmd, '-r']
if not kwargs['verbose']:
cmdlist.append('-q')
cmdlist.extend(args)
cmdlist.append(archive)
return cmdlist

View File

@ -169,6 +169,8 @@ class ArchiveTest (unittest.TestCase):
elif self.program in ('rzip', 'shorten'): elif self.program in ('rzip', 'shorten'):
program = 'py_echo' program = 'py_echo'
command = 'list' command = 'list'
elif self.program == 'lcab':
program = 'cabextract'
patoolib._handle_archive(archive, command, program=program) patoolib._handle_archive(archive, command, program=program)
finally: finally:
os.chdir(basedir) os.chdir(basedir)

Binary file not shown.

View File

@ -339,6 +339,12 @@ class TestArchives (ArchiveTest):
self.program = 'orange' self.program = 'orange'
self.archive_extract('t.cab') self.archive_extract('t.cab')
@needs_program('lcab')
@needs_program('cabextract')
def test_lcab (self):
self.program = 'lcab'
self.archive_create('t.cab')
@needs_program('arj') @needs_program('arj')
def test_arj (self): def test_arj (self):
self.program = 'arj' self.program = 'arj'

View File

@ -375,6 +375,12 @@ class TestArchives (ArchiveTest):
self.program = 'orange' self.program = 'orange'
self.archive_extract('t.cab.foo') self.archive_extract('t.cab.foo')
@needs_program('lcab')
@needs_program('cabextract')
def test_lcab (self):
self.program = 'lcab'
self.archive_create('t.cab.foo', format="cab")
@needs_program('file') @needs_program('file')
@needs_program('arj') @needs_program('arj')
def test_arj (self): def test_arj (self):