From f25df5673339e3d8055979e53178c7044892e1e5 Mon Sep 17 00:00:00 2001 From: Bastian Kleineidam Date: Fri, 5 Apr 2013 18:46:30 +0200 Subject: [PATCH] Fix repacking with 7z --- doc/changelog.txt | 1 + patoolib/programs/p7zip.py | 16 ++++++++++++---- 2 files changed, 13 insertions(+), 4 deletions(-) diff --git a/doc/changelog.txt b/doc/changelog.txt index 2bb6473..e3a44cc 100644 --- a/doc/changelog.txt +++ b/doc/changelog.txt @@ -1,6 +1,7 @@ 1.1 "" (released xx.xx.2013) * Add support for zopfli, Googles new zlib compressor. +* Fix an error repacking compressed tar archives with 7z. 1.0 "Robot and Frank" (released 1.3.2013) diff --git a/patoolib/programs/p7zip.py b/patoolib/programs/p7zip.py index 99a4b1a..698033b 100644 --- a/patoolib/programs/p7zip.py +++ b/patoolib/programs/p7zip.py @@ -15,14 +15,24 @@ # along with this program. If not, see . """Archive commands for the 7z program.""" -def extract_7z (archive, compression, cmd, verbosity, outdir): +def extract_7z(archive, compression, cmd, verbosity, outdir): """Extract a 7z archive.""" return [cmd, 'x', '-o%s' % outdir, '--', archive] +def extract_7z_singlefile(archive, compression, cmd, verbosity, outdir): + """Extract a singlefile archive (eg. gzip or bzip2) with '7z e'. + This makes sure a single file and no subdirectories are created, + which would cause errors with patool repack.""" + return [cmd, 'e', '-o%s' % outdir, '--', archive] + extract_bzip2 = \ extract_gzip = \ - extract_zip = \ extract_compress = \ + extract_xz = \ + extract_lzma = \ + extract_7z_singlefile + +extract_zip = \ extract_rar = \ extract_cab = \ extract_arj = \ @@ -30,8 +40,6 @@ extract_bzip2 = \ extract_rpm = \ extract_deb = \ extract_iso = \ - extract_xz = \ - extract_lzma = \ extract_7z def list_7z (archive, compression, cmd, verbosity):