Add support for zopfli.

This commit is contained in:
Bastian Kleineidam 2013-03-28 19:42:50 +01:00
parent 137550e57b
commit e9f1a5e515
4 changed files with 61 additions and 1 deletions

View File

@ -1,3 +1,8 @@
1.1 "" (released xx.xx.2013)
* Add support for zopfli, Googles new zlib compressor.
1.0 "Robot and Frank" (released 1.3.2013)
* Add support for searching in archive contents.

View File

@ -159,7 +159,7 @@ ArchivePrograms = {
'gzip': {
None: ('7z', '7za', 'pigz', 'gzip'),
'extract': ('py_gzip',),
'create': ('py_gzip',),
'create': ('zopfli', 'py_gzip'),
},
'iso': {
'extract': ('7z',),

View File

@ -0,0 +1,25 @@
# -*- coding: utf-8 -*-
# Copyright (C) 2013 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 zopfli program."""
from .. import util
def create_gzip(archive, compression, cmd, verbosity, filenames):
"""Create a GZIP archive."""
cmdlist = [util.shell_quote(cmd)]
cmdlist.extend(['-c', '--'])
cmdlist.extend([util.shell_quote(x) for x in filenames])
cmdlist.extend(['>', util.shell_quote(archive)])
return (cmdlist, {'shell': True})

View File

@ -0,0 +1,30 @@
# -*- coding: utf-8 -*-
# Copyright (C) 2013 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/>.
from . import ArchiveTest, Content
from .. import needs_program
class TestZopfli(ArchiveTest):
program = 'zopfli'
@needs_program(program)
def test_zopfli(self):
self.archive_extract('t.txt.gz', check=Content.Singlefile)
@needs_program('file')
@needs_program(program)
def test_zopfli_file(self):
self.archive_extract('t.txt.gz.foo', check=Content.Singlefile)