From b51777c8f11b6b182f81e50e7197e83e2a3d38b5 Mon Sep 17 00:00:00 2001 From: Bastian Kleineidam Date: Wed, 3 Mar 2010 21:04:02 +0100 Subject: [PATCH] Support decompressing files without .lzo extension. --- patoolib/programs/lzop.py | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/patoolib/programs/lzop.py b/patoolib/programs/lzop.py index 5d6fefe..c0c96d3 100644 --- a/patoolib/programs/lzop.py +++ b/patoolib/programs/lzop.py @@ -14,15 +14,24 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . """Archive commands for the lzop program.""" +import os +from patoolib import util + def extract_lzop (archive, encoding, cmd, **kwargs): """Extract a LZOP archive.""" cmdlist = [cmd] - cmdlist.append('--decompress') + cmdlist.extend(['-c', '-d']) if kwargs['verbose']: cmdlist.append('--verbose') - cmdlist.extend(['-p%s' % kwargs["outdir"], '--', archive]) - return cmdlist + cmdlist.append('--') + outfile = os.path.join(kwargs['outdir'], util.stripext(archive)) + if archive == outfile: + outfile = archive + ".raw" + cmdlist.extend([archive, '>', outfile]) + # note that for shell calls the command must be a string + cmd = " ".join([util.shell_quote(x) for x in cmdlist]) + return (cmd, {'shell': True}) def list_lzop (archive, encoding, cmd, **kwargs): """List a LZOP archive."""