Index: gclient_utils.py |
=================================================================== |
--- gclient_utils.py (revision 132150) |
+++ gclient_utils.py (working copy) |
@@ -193,6 +193,17 @@ |
raise |
+def FindCommandExecutable(cmd): |
+ """Find the specified |cmd| in $PATH and checks if it's executable. |
+ Raise an exception if fails. Otherwise do nothing.""" |
+ paths = os.environ['PATH'].split(os.pathsep) |
+ for path in paths: |
M-A Ruel
2012/04/13 18:55:25
for path in os.environ['PATH'].split(os.pathsep):
Jun Mukai
2012/04/16 05:39:22
Done.
|
+ full_path = os.path.join(path, cmd) |
+ if os.path.isfile(full_path) and os.access(full_path, os.X_OK): |
+ return full_path |
+ return None |
+ |
+ |
def CheckCallAndFilterAndHeader(args, always=False, **kwargs): |
"""Adds 'header' support to CheckCallAndFilter. |