Add LZMA functions for xz, fixing build errors.
This commit is contained in:
parent
e6018f0cff
commit
47929ecac8
|
@ -226,10 +226,10 @@ ArchivePrograms = {
|
||||||
None: ('lzop',),
|
None: ('lzop',),
|
||||||
},
|
},
|
||||||
'lzma': {
|
'lzma': {
|
||||||
'extract': ('7z', 'lzma') + py_lzma,
|
'extract': ('7z', 'lzma', 'xz') + py_lzma,
|
||||||
'list': ('7z', 'py_echo'),
|
'list': ('7z', 'py_echo'),
|
||||||
'test': ('7z', 'lzma'),
|
'test': ('7z', 'lzma', 'xz'),
|
||||||
'create': ('lzma',) + py_lzma,
|
'create': ('lzma', 'xz') + py_lzma,
|
||||||
},
|
},
|
||||||
'rzip': {
|
'rzip': {
|
||||||
'extract': ('rzip',),
|
'extract': ('rzip',),
|
||||||
|
|
|
@ -16,6 +16,7 @@
|
||||||
"""Archive commands for the xz program."""
|
"""Archive commands for the xz program."""
|
||||||
from . import extract_singlefile_standard, \
|
from . import extract_singlefile_standard, \
|
||||||
test_singlefile_standard, create_singlefile_standard
|
test_singlefile_standard, create_singlefile_standard
|
||||||
|
from .. import util
|
||||||
|
|
||||||
|
|
||||||
extract_xz = extract_singlefile_standard
|
extract_xz = extract_singlefile_standard
|
||||||
|
@ -30,3 +31,34 @@ def list_xz (archive, compression, cmd, verbosity):
|
||||||
cmdlist.append('-v')
|
cmdlist.append('-v')
|
||||||
cmdlist.append(archive)
|
cmdlist.append(archive)
|
||||||
return cmdlist
|
return cmdlist
|
||||||
|
|
||||||
|
|
||||||
|
def extract_lzma(archive, compression, cmd, verbosity, outdir):
|
||||||
|
"""Extract an LZMA archive."""
|
||||||
|
cmdlist = [util.shell_quote(cmd), '--format=lzma']
|
||||||
|
if verbosity > 1:
|
||||||
|
cmdlist.append('-v')
|
||||||
|
outfile = util.get_single_outfile(outdir, archive)
|
||||||
|
cmdlist.extend(['-c', '-d', '--', util.shell_quote(archive), '>',
|
||||||
|
util.shell_quote(outfile)])
|
||||||
|
return (cmdlist, {'shell': True})
|
||||||
|
|
||||||
|
|
||||||
|
def test_lzma(archive, compression, cmd, verbosity):
|
||||||
|
"""Test an LZMA archive."""
|
||||||
|
cmdlist = [cmd, '--format=lzma']
|
||||||
|
if verbosity > 1:
|
||||||
|
cmdlist.append('-v')
|
||||||
|
cmdlist.extend(['--test', archive])
|
||||||
|
return cmdlist
|
||||||
|
|
||||||
|
|
||||||
|
def create_lzma(archive, compression, cmd, verbosity, filenames):
|
||||||
|
"""Create an LZMA archive."""
|
||||||
|
cmdlist = [util.shell_quote(cmd), '--format=lzma']
|
||||||
|
if verbosity > 1:
|
||||||
|
cmdlist.append('-v')
|
||||||
|
cmdlist.extend(['-c', '--'])
|
||||||
|
cmdlist.extend([util.shell_quote(x) for x in filenames])
|
||||||
|
cmdlist.extend(['>', util.shell_quote(archive)])
|
||||||
|
return (cmdlist, {'shell': True})
|
||||||
|
|
|
@ -30,3 +30,8 @@ class TestXz (ArchiveTest):
|
||||||
self.archive_test('t.txt.xz.foo')
|
self.archive_test('t.txt.xz.foo')
|
||||||
self.archive_extract('t.txt.xz.foo', check=Content.Singlefile)
|
self.archive_extract('t.txt.xz.foo', check=Content.Singlefile)
|
||||||
|
|
||||||
|
@needs_program(program)
|
||||||
|
def test_lzma(self):
|
||||||
|
self.archive_test('t.txt.lzma')
|
||||||
|
self.archive_extract('t.txt.lzma', check=Content.Singlefile)
|
||||||
|
self.archive_create('t.txt.lzma', check=Content.Singlefile)
|
||||||
|
|
Loading…
Reference in New Issue