add 7za as alias for 7z and 7zr.

This commit is contained in:
clinton-hall 2014-11-01 08:30:49 +10:30
commit 9b143cd6f2
2 changed files with 6 additions and 0 deletions

View file

@ -630,6 +630,10 @@ def initialize(section=None):
try: try:
SEVENZIP = subprocess.Popen(['which', '7zr'], stdout=subprocess.PIPE).communicate()[0].strip() SEVENZIP = subprocess.Popen(['which', '7zr'], stdout=subprocess.PIPE).communicate()[0].strip()
except: pass except: pass
if not SEVENZIP:
try:
SEVENZIP = subprocess.Popen(['which', '7za'], stdout=subprocess.PIPE).communicate()[0].strip()
except: pass
if not SEVENZIP: if not SEVENZIP:
SEVENZIP = None SEVENZIP = None
logger.warning("Failed to locate 7zip. Transcosing of disk images and extraction of .7z files will not be possible!") logger.warning("Failed to locate 7zip. Transcosing of disk images and extraction of .7z files will not be possible!")

View file

@ -47,6 +47,8 @@ def extract(filePath, outputDestination):
if call(['which', cmd], stdout=devnull, stderr=devnull): #note, returns 0 if exists, or 1 if doesn't exist. if call(['which', cmd], stdout=devnull, stderr=devnull): #note, returns 0 if exists, or 1 if doesn't exist.
if cmd == "7zr" and not call(["which", "7z"]): # we do have "7z" command if cmd == "7zr" and not call(["which", "7z"]): # we do have "7z" command
EXTRACT_COMMANDS[".7z"] = ["7z", "x"] EXTRACT_COMMANDS[".7z"] = ["7z", "x"]
elif cmd == "7zr" and not call(["which", "7za"]): # we do have "7za" command
EXTRACT_COMMANDS[".7z"] = ["7za", "x"]
else: else:
for k, v in EXTRACT_COMMANDS.items(): for k, v in EXTRACT_COMMANDS.items():
if cmd in v[0]: if cmd in v[0]: