Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1)

Unified Diff: gclient_utils.py

Issue 10034011: Check the existence and executability of scm commands (Closed) Base URL: http://src.chromium.org/svn/trunk/tools/depot_tools/
Patch Set: Created 8 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « gclient_scm.py ('k') | tests/gclient_scm_test.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: gclient_utils.py
===================================================================
--- gclient_utils.py (revision 132376)
+++ gclient_utils.py (working copy)
@@ -193,6 +193,16 @@
raise
+def FindCommandExecutable(cmd):
+ """Finds the specified |cmd| in $PATH and returns its path. Returns None
+ if it's not found."""
+ for path in os.environ['PATH'].split(os.pathsep):
+ 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.
« no previous file with comments | « gclient_scm.py ('k') | tests/gclient_scm_test.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698