x64 support on windows

This commit is contained in:
Joel Kåberg 2013-02-26 14:07:16 +01:00
commit f5aa03b73d
6 changed files with 23 additions and 7 deletions

View file

@ -304,9 +304,10 @@ for dirpath, dirnames, filenames in os.walk(inputDirectory):
Logger.info("MAIN: Found compressed archive %s for file %s", fileExtention, filePath) Logger.info("MAIN: Found compressed archive %s for file %s", fileExtention, filePath)
source = filePath source = filePath
target = os.path.join(outputDestination, file) target = os.path.join(outputDestination, file)
state = extractor.extract(dirpath, file, outputDestination) try:
if state == False: extractor.extract(dirpath, file, outputDestination)
Logger.info("MAIN: Failed to unpack file %s", file) except:
Logger.warn("Extraction failed")
failed_extract = 1 failed_extract = 1
else: else:
Logger.info("MAIN: Ignoring unknown filetype %s for file %s", fileExtention, filePath) Logger.info("MAIN: Ignoring unknown filetype %s for file %s", fileExtention, filePath)

BIN
extractor/bin/x64/7z.dll Normal file

Binary file not shown.

BIN
extractor/bin/x64/7z.exe Normal file

Binary file not shown.

View file

@ -4,7 +4,18 @@ import logging
Logger = logging.getLogger(__name__) Logger = logging.getLogger(__name__)
# which() breaks when running in Transmission (has to do with os.environ["PATH"]) # which() and os_platform() breaks when running in Transmission (has to do with os.environ)
def os_platform():
# Author Credit: Matthew Scouten @ http://stackoverflow.com/a/7260315
true_platform = os.environ['PROCESSOR_ARCHITECTURE']
try:
true_platform = os.environ["PROCESSOR_ARCHITEW6432"]
except KeyError:
pass
#true_platform not assigned to if this does not exist
return true_platform
def which(program): def which(program):
# Author Credit: Jay @ http://stackoverflow.com/a/377028 # Author Credit: Jay @ http://stackoverflow.com/a/377028
def is_exe(fpath): def is_exe(fpath):
@ -25,8 +36,12 @@ def which(program):
def extract(dirpath, file, outputDestination): def extract(dirpath, file, outputDestination):
# Using Windows # Using Windows
if os.name == 'nt': if os.name == 'nt':
binLocation = 'extractor/bin/7z.exe' # Only 32bit for now if os_platform() == 'AMD64':
sevenzipLocation = os.path.normpath(os.path.join(os.path.dirname(sys.argv[0]), binLocation)) platform = 'x64'
else:
platform = 'x86'
sevenzipLocation = os.path.normpath(os.path.join(os.path.dirname(sys.argv[0]), 'extractor/bin/' + platform + '/7z.exe'))
if not os.path.exists(sevenzipLocation): if not os.path.exists(sevenzipLocation):
Logger.error("EXTRACTOR: Couldnt find 7-zip, Exiting") Logger.error("EXTRACTOR: Couldnt find 7-zip, Exiting")
sys.exit(-1) sys.exit(-1)