Commit c283323a authored by Robert Loehning's avatar Robert Loehning Committed by Robert Löhning

Squish: Fixed searching for external tools

Change-Id: Iad16f3e7a7a4c886bcd2b7eb9bf94ded9926d37f
Reviewed-by: default avatarChristian Stenger <christian.stenger@nokia.com>
parent 63f3b2fe
......@@ -100,24 +100,35 @@ def which(program):
def is_exe(fpath):
return os.path.exists(fpath) and os.access(fpath, os.X_OK)
fpath, fname = os.path.split(program)
if fpath:
if is_exe(program):
return program
def callableFile(path):
if is_exe(path):
return path
if platform.system() in ('Windows', 'Microsoft'):
if is_exe(program + ".exe"):
return program + ".exe"
for suffix in suffixes.split(os.pathsep):
if is_exe(path + suffix):
return path + suffix
return None
if platform.system() in ('Windows', 'Microsoft'):
suffixes = os.getenv("PATHEXT")
if not suffixes:
test.fatal("Can't read environment variable PATHEXT. Please check your installation.")
suffixes = ""
fpath, fname = os.path.split(program)
if fpath:
return callableFile(program)
else:
if platform.system() in ('Windows', 'Microsoft'):
cf = callableFile(os.getcwd() + os.sep + program)
if cf:
return cf
for path in os.environ["PATH"].split(os.pathsep):
exe_file = os.path.join(path, program)
if is_exe(exe_file):
return exe_file
if platform.system() in ('Windows', 'Microsoft'):
if is_exe(exe_file + ".exe"):
return exe_file + ".exe"
return None
cf = callableFile(exe_file)
if cf:
return cf
return None
signalObjects = {}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment