Skip to content
This repository was archived by the owner on Sep 22, 2022. It is now read-only.

lzma on Linux #1

Closed
eiselekd opened this issue Oct 9, 2017 · 1 comment
Closed

lzma on Linux #1

eiselekd opened this issue Oct 9, 2017 · 1 comment

Comments

@eiselekd
Copy link

eiselekd commented Oct 9, 2017

On Linux the lzma command in recent distributions for decompression via stdin/stdout is:
cat in | lzma -d > out
so this patch is maybe useful:

index a450204..627e010 100644
--- a/unME11.py
+++ b/unME11.py
@@ -76,7 +76,11 @@ aPubKeyHash = [v.decode("hex") for v in (
 #***************************************************************************
 
 def LZMA_decompress(compdata):
-  process = subprocess.Popen(["lzma", "d", "-si", "-so"], stdin=subprocess.PIPE, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
+  import os
+  a = ["lzma", "d", "-si", "-so"]
+  if not os.name == 'nt':
+    a = ["lzma", "-d"]
+  process = subprocess.Popen(a, stdin=subprocess.PIPE, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
   output, errout = process.communicate(compdata)
   retcode = process.poll()
   if retcode: raise Error(errout)

@Piker-Alpha
Copy link

Piker-Alpha commented Nov 9, 2017

I don't know if they really care, since there's no response whatsoever so far, but that doesn't work for me. This will do the trick:

import os, sys, struct, hashlib, platform

p = platform.system()

if p == "Darwin":
	args = ["/usr/local/bin/lzmadec", "-"]
elif p == "Windows":
	args = ["lzma", "-d"]
elif p == "Linux":
	args = ["lzma", "d", "-si", "-so"]

process = subprocess.Popen(args, stdin=subprocess.PIPE, stdout=subprocess.PIPE, stderr=subprocess.PIPE)

Also required for macOS is one of these:

brew install xz

or

sudo port install xz

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants