Support the nomarch tool for handling ARC files.

This commit is contained in:
Bastian Kleineidam 2010-03-08 18:36:18 +01:00
parent 4f12f39834
commit 2f5addad3f
5 changed files with 52 additions and 1 deletions

View File

@ -1 +0,0 @@
nomarch

View File

@ -89,6 +89,9 @@ ArchivePrograms = {
},
'arc': {
None: ('arc',),
'extract': ('nomarch',),
'test': ('nomarch',),
'list': ('nomarch',),
},
'bzip2': {
'extract': ('pbzip2', 'bzip2', '7z'),

View File

@ -0,0 +1,35 @@
# -*- 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 nomarch program."""
def extract_arc (archive, encoding, cmd, **kwargs):
"""Extract a ARC archive."""
# Since extracted files will be placed in the current directory,
# the cwd argument has to be the output directory.
cmdlist = [cmd, archive]
return (cmdlist, {'cwd': kwargs['outdir']})
def list_arc (archive, encoding, cmd, **kwargs):
"""List a ARC archive."""
cmdlist = [cmd, '-l']
if kwargs['verbose']:
cmdlist.append('-v')
cmdlist.append(archive)
return cmdlist
def test_arc (archive, encoding, cmd, **kwargs):
"""Test a ARC archive."""
return [cmd, '-t', archive]

View File

@ -295,3 +295,10 @@ class TestArchives (ArchiveTest):
def test_arc (self):
self.program = 'arc'
self.archive_commands('t.arc', singlefile=True)
@needs_program('nomarch')
def test_nomarch (self):
self.program = 'nomarch'
self.archive_test('t.arc')
self.archive_list('t.arc')
self.archive_extract('t.arc')

View File

@ -340,3 +340,10 @@ class TestArchives (ArchiveTest):
def test_arc (self):
self.program = 'arc'
self.archive_commands('t.arc.foo', format="arc", singlefile=True)
@needs_program('nomarch')
def test_nomarch (self):
self.program = 'nomarch'
self.archive_test('t.arc.foo')
self.archive_list('t.arc.foo')
self.archive_extract('t.arc.foo')