diff options
author | Jukka Jylänki <jujjyl@gmail.com> | 2013-09-10 16:02:45 +0300 |
---|---|---|
committer | Jukka Jylänki <jujjyl@gmail.com> | 2013-09-10 16:02:45 +0300 |
commit | 5ad48b3982d912c557a871e4219e12c1eef6dd69 (patch) | |
tree | ccf868f02132def8bb3347ba29cfcf503bebe82a | |
parent | ee8d8b0dfc9335bc715440d6bc466a607d6e86bc (diff) |
Fix indentation in Building.which() function.
-rw-r--r-- | tools/shared.py | 48 |
1 files changed, 24 insertions, 24 deletions
diff --git a/tools/shared.py b/tools/shared.py index 5beaab60..e5ace821 100644 --- a/tools/shared.py +++ b/tools/shared.py @@ -823,30 +823,30 @@ class Building: # Finds the given executable 'program' in PATH. Operates like the Unix tool 'which'. @staticmethod def which(program): - import os - def is_exe(fpath): - return os.path.isfile(fpath) and os.access(fpath, os.X_OK) - - fpath, fname = os.path.split(program) - if fpath: - if is_exe(program): - return program - else: - for path in os.environ["PATH"].split(os.pathsep): - path = path.strip('"') - exe_file = os.path.join(path, program) - if is_exe(exe_file): - return exe_file - - if WINDOWS and not '.' in fname: - if is_exe(exe_file + '.exe'): - return exe_file + '.exe' - if is_exe(exe_file + '.cmd'): - return exe_file + '.cmd' - if is_exe(exe_file + '.bat'): - return exe_file + '.bat' - - return None + import os + def is_exe(fpath): + return os.path.isfile(fpath) and os.access(fpath, os.X_OK) + + fpath, fname = os.path.split(program) + if fpath: + if is_exe(program): + return program + else: + for path in os.environ["PATH"].split(os.pathsep): + path = path.strip('"') + exe_file = os.path.join(path, program) + if is_exe(exe_file): + return exe_file + + if WINDOWS and not '.' in fname: + if is_exe(exe_file + '.exe'): + return exe_file + '.exe' + if is_exe(exe_file + '.cmd'): + return exe_file + '.cmd' + if is_exe(exe_file + '.bat'): + return exe_file + '.bat' + + return None @staticmethod def handle_CMake_toolchain(args, env): |