From aa7776875bf9c24849c7d3f516b72e3d335ada67 Mon Sep 17 00:00:00 2001 From: zmr Date: Sun, 29 May 2022 14:26:07 +0800 Subject: [PATCH] skip file if have same file or passwd --- patoolib/programs/p7rzip.py | 36 +++++++++++++++++++++++++++++++----- patoolib/programs/p7zip.py | 12 ++++++++---- 2 files changed, 39 insertions(+), 9 deletions(-) diff --git a/patoolib/programs/p7rzip.py b/patoolib/programs/p7rzip.py index 2e4d15f..87968cf 100644 --- a/patoolib/programs/p7rzip.py +++ b/patoolib/programs/p7rzip.py @@ -18,8 +18,34 @@ 7zr is a light executable supporting only the 7z archive format. """ -from .p7zip import \ - extract_7z, \ - list_7z, \ - test_7z, \ - create_7z +#from .p7zip import \ +# extract_7z, \ +# list_7z, \ +# test_7z, \ +# create_7z +from .p7zip import create_7z + +def extract_7z(archive, compression, cmd, verbosity, interactive, outdir): + """Extract a 7z archive.""" + cmdlist = [cmd, 'x'] + if not interactive: + cmdlist.append('-y') + cmdlist.extend(['-o%s' % outdir, '--', archive]) + return cmdlist + +def list_7z(archive, compression, cmd, verbosity, interactive): + """List a 7z archive.""" + cmdlist = [cmd, 'l'] + if not interactive: + cmdlist.append('-y') + cmdlist.extend(['--', archive]) + return cmdlist + +def test_7z(archive, compression, cmd, verbosity, interactive): + """Test a 7z archive.""" + cmdlist = [cmd, 't'] + if not interactive: + cmdlist.append('-y') + cmdlist.extend(['--', archive]) + return cmdlist + \ No newline at end of file diff --git a/patoolib/programs/p7zip.py b/patoolib/programs/p7zip.py index efb819d..accbe33 100644 --- a/patoolib/programs/p7zip.py +++ b/patoolib/programs/p7zip.py @@ -23,7 +23,8 @@ def extract_7z(archive, compression, cmd, verbosity, interactive, outdir, passwo """Extract a 7z archive.""" cmdlist = [cmd, 'x'] if not interactive: - cmdlist.append('-y') + #cmdlist.append('-y') + cmdlist.extend(['-p-', '-y']) _maybe_add_password(cmdlist, password) cmdlist.extend(['-o%s' % outdir, '--', archive]) return cmdlist @@ -34,7 +35,8 @@ def extract_7z_singlefile(archive, compression, cmd, verbosity, interactive, out which would cause errors with patool repack.""" cmdlist = [cmd, 'e'] if not interactive: - cmdlist.append('-y') + #cmdlist.append('-y') + cmdlist.extend(['-p-', '-y']) _maybe_add_password(cmdlist, password) cmdlist.extend(['-o%s' % outdir, '--', archive]) return cmdlist @@ -61,7 +63,8 @@ def list_7z (archive, compression, cmd, verbosity, interactive, password=None): """List a 7z archive.""" cmdlist = [cmd, 'l'] if not interactive: - cmdlist.append('-y') + #cmdlist.append('-y') + cmdlist.extend(['-p-', '-y']) _maybe_add_password(cmdlist, password) cmdlist.extend(['--', archive]) return cmdlist @@ -87,7 +90,8 @@ def test_7z (archive, compression, cmd, verbosity, interactive, password=None): """Test a 7z archive.""" cmdlist = [cmd, 't'] if not interactive: - cmdlist.append('-y') + #cmdlist.append('-y') + cmdlist.extend(['-p-', '-y']) _maybe_add_password(cmdlist, password) cmdlist.extend(['--', archive]) return cmdlist