diff options
author | Robert Loehning <robert.loehning@nokia.com> | 2012-03-05 17:16:36 +0100 |
---|---|---|
committer | Robert Löhning <robert.loehning@nokia.com> | 2012-03-05 17:58:15 +0100 |
commit | c283323afd5d9012782027d062a4629e32d7ad9e (patch) | |
tree | 747b1cb244f76afbe83e320e389600178b696d22 /tests | |
parent | 63f3b2feb606aecb9aaeecf6d8ed326cb019201b (diff) |
Squish: Fixed searching for external tools
Change-Id: Iad16f3e7a7a4c886bcd2b7eb9bf94ded9926d37f
Reviewed-by: Christian Stenger <christian.stenger@nokia.com>
Diffstat (limited to 'tests')
-rw-r--r-- | tests/system/shared/utils.py | 37 |
1 files changed, 24 insertions, 13 deletions
diff --git a/tests/system/shared/utils.py b/tests/system/shared/utils.py index 246731d2bf..1c120e1f1e 100644 --- a/tests/system/shared/utils.py +++ b/tests/system/shared/utils.py @@ -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 = {} |