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

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: Fix a silly typo 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') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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.
« no previous file with comments | « gclient_scm.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698