diff --git a/doc/changelog.txt b/doc/changelog.txt index 1b1fc7f..2bb6473 100644 --- a/doc/changelog.txt +++ b/doc/changelog.txt @@ -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. diff --git a/patoolib/__init__.py b/patoolib/__init__.py index 798be3c..278cde3 100644 --- a/patoolib/__init__.py +++ b/patoolib/__init__.py @@ -159,7 +159,7 @@ ArchivePrograms = { 'gzip': { None: ('7z', '7za', 'pigz', 'gzip'), 'extract': ('py_gzip',), - 'create': ('py_gzip',), + 'create': ('zopfli', 'py_gzip'), }, 'iso': { 'extract': ('7z',), diff --git a/patoolib/programs/zopfli.py b/patoolib/programs/zopfli.py new file mode 100644 index 0000000..821a272 --- /dev/null +++ b/patoolib/programs/zopfli.py @@ -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 . +"""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}) diff --git a/tests/archives/test_zopfli.py b/tests/archives/test_zopfli.py new file mode 100644 index 0000000..460aee9 --- /dev/null +++ b/tests/archives/test_zopfli.py @@ -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 . +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)