Support decompressing files without .lzo extension.
This commit is contained in:
parent
0da08cf20c
commit
b51777c8f1
|
@ -14,15 +14,24 @@
|
||||||
# You should have received a copy of the GNU General Public License
|
# You should have received a copy of the GNU General Public License
|
||||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
"""Archive commands for the lzop program."""
|
"""Archive commands for the lzop program."""
|
||||||
|
import os
|
||||||
|
from patoolib import util
|
||||||
|
|
||||||
|
|
||||||
def extract_lzop (archive, encoding, cmd, **kwargs):
|
def extract_lzop (archive, encoding, cmd, **kwargs):
|
||||||
"""Extract a LZOP archive."""
|
"""Extract a LZOP archive."""
|
||||||
cmdlist = [cmd]
|
cmdlist = [cmd]
|
||||||
cmdlist.append('--decompress')
|
cmdlist.extend(['-c', '-d'])
|
||||||
if kwargs['verbose']:
|
if kwargs['verbose']:
|
||||||
cmdlist.append('--verbose')
|
cmdlist.append('--verbose')
|
||||||
cmdlist.extend(['-p%s' % kwargs["outdir"], '--', archive])
|
cmdlist.append('--')
|
||||||
return cmdlist
|
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):
|
def list_lzop (archive, encoding, cmd, **kwargs):
|
||||||
"""List a LZOP archive."""
|
"""List a LZOP archive."""
|
||||||
|
|
Loading…
Reference in New Issue