From 1d121c4c794984f20dc8361d7f38c9e8dc840fe6 Mon Sep 17 00:00:00 2001 From: Bastian Kleineidam Date: Sat, 9 Jan 2016 20:25:26 +0100 Subject: [PATCH] Fix 7z unpacking when only p7zip with /usr/bin/7zr is installed. --- doc/changelog.txt | 5 +++++ patoolib/__init__.py | 3 ++- patoolib/programs/p7rzip.py | 25 +++++++++++++++++++++++++ setup.py | 5 +---- tests/archives/test_7zr.py | 30 ++++++++++++++++++++++++++++++ 5 files changed, 63 insertions(+), 5 deletions(-) create mode 100644 patoolib/programs/p7rzip.py create mode 100644 tests/archives/test_7zr.py diff --git a/doc/changelog.txt b/doc/changelog.txt index 8cb11b1..1312e10 100644 --- a/doc/changelog.txt +++ b/doc/changelog.txt @@ -1,3 +1,8 @@ +1.11 (released xx.xx.216) + +* Fix 7z unpacking when only p7zip with /usr/bin/7zr is installed. + + 1.10 (released 10.12.2015) * Added support for VHD (Virtual Hard Disk) archives with 7z. diff --git a/patoolib/__init__.py b/patoolib/__init__.py index 94f1d70..4de17b6 100644 --- a/patoolib/__init__.py +++ b/patoolib/__init__.py @@ -196,7 +196,7 @@ ArchivePrograms = { 'create': ('compress',), }, '7z': { - None: ('7z', '7za'), + None: ('7z', '7za', '7zr'), }, 'rar': { None: ('rar',), @@ -277,6 +277,7 @@ ArchivePrograms = { ProgramModules = { '7z': 'p7zip', '7za': 'p7azip', + '7zr': 'p7rzip', 'uncompress.real': 'uncompress', 'dpkg-deb': 'dpkg', 'extract_chmlib': 'chmlib', diff --git a/patoolib/programs/p7rzip.py b/patoolib/programs/p7rzip.py new file mode 100644 index 0000000..2e4d15f --- /dev/null +++ b/patoolib/programs/p7rzip.py @@ -0,0 +1,25 @@ +# -*- coding: utf-8 -*- +# Copyright (C) 2016 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 7zr program. + +7zr is a light executable supporting only the 7z archive format. +""" + +from .p7zip import \ + extract_7z, \ + list_7z, \ + test_7z, \ + create_7z diff --git a/setup.py b/setup.py index 5b366fe..d6115bd 100644 --- a/setup.py +++ b/setup.py @@ -23,9 +23,6 @@ if not hasattr(sys, "version_info") or sys.version_info < (2, 7, 0, "final", 0): raise SystemExit("This program requires Python 2.7 or later.") import os import re -import shutil -import glob -import subprocess from setuptools import setup from distutils.core import Distribution from distutils.command.install_lib import install_lib @@ -33,7 +30,7 @@ from distutils import util from distutils.file_util import write_file AppName = "patool" -AppVersion = "1.10" +AppVersion = "1.11" MyName = "Bastian Kleineidam" MyEmail = "bastian.kleineidam@web.de" diff --git a/tests/archives/test_7zr.py b/tests/archives/test_7zr.py new file mode 100644 index 0000000..671e37e --- /dev/null +++ b/tests/archives/test_7zr.py @@ -0,0 +1,30 @@ +# -*- coding: utf-8 -*- +# Copyright (C) 2010-2015 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 +from .. import needs_program + +class Test7zr (ArchiveTest): + + program = '7zr' + + @needs_program(program) + def test_7zr (self): + self.archive_commands('t .7z') + + @needs_program('file') + @needs_program(program) + def test_7z_file (self): + self.archive_commands('t.7z.foo', skip_create=True)