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

Side by Side Diff: gclient_utils.py

Issue 9956149: Revert r132446 "Check the existence and executability of scm commands" (Closed) Base URL: svn://svn.chromium.org/chrome/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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « gclient_scm.py ('k') | tests/gclient_scm_test.py » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 # Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 # Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 # Use of this source code is governed by a BSD-style license that can be 2 # Use of this source code is governed by a BSD-style license that can be
3 # found in the LICENSE file. 3 # found in the LICENSE file.
4 4
5 """Generic utils.""" 5 """Generic utils."""
6 6
7 import errno 7 import errno
8 import logging 8 import logging
9 import os 9 import os
10 import Queue 10 import Queue
(...skipping 175 matching lines...) Expand 10 before | Expand all | Expand 10 after
186 os.makedirs(tree) 186 os.makedirs(tree)
187 except OSError, e: 187 except OSError, e:
188 # 17 POSIX, 183 Windows 188 # 17 POSIX, 183 Windows
189 if e.errno not in (17, 183): 189 if e.errno not in (17, 183):
190 raise 190 raise
191 if count > 40: 191 if count > 40:
192 # Give up. 192 # Give up.
193 raise 193 raise
194 194
195 195
196 def FindCommandExecutable(cmd):
197 """Finds the specified |cmd| in $PATH and returns its path. Returns None
198 if it's not found."""
199 for path in os.environ['PATH'].split(os.pathsep):
200 full_path = os.path.join(path, cmd)
201 if os.path.isfile(full_path) and os.access(full_path, os.X_OK):
202 return full_path
203 return None
204
205
206 def CheckCallAndFilterAndHeader(args, always=False, **kwargs): 196 def CheckCallAndFilterAndHeader(args, always=False, **kwargs):
207 """Adds 'header' support to CheckCallAndFilter. 197 """Adds 'header' support to CheckCallAndFilter.
208 198
209 If |always| is True, a message indicating what is being done 199 If |always| is True, a message indicating what is being done
210 is printed to stdout all the time even if not output is generated. Otherwise 200 is printed to stdout all the time even if not output is generated. Otherwise
211 the message header is printed only if the call generated any ouput. 201 the message header is printed only if the call generated any ouput.
212 """ 202 """
213 stdout = kwargs.get('stdout', None) or sys.stdout 203 stdout = kwargs.get('stdout', None) or sys.stdout
214 if always: 204 if always:
215 stdout.write('\n________ running \'%s\' in \'%s\'\n' 205 stdout.write('\n________ running \'%s\' in \'%s\'\n'
(...skipping 560 matching lines...) Expand 10 before | Expand all | Expand 10 after
776 keyvals = dict([x.strip() for x in l.split(':', 1)] for l in lines if l) 766 keyvals = dict([x.strip() for x in l.split(':', 1)] for l in lines if l)
777 except ValueError: 767 except ValueError:
778 raise Error( 768 raise Error(
779 'Failed to process settings, please fix. Content:\n\n%s' % content) 769 'Failed to process settings, please fix. Content:\n\n%s' % content)
780 def fix_url(key): 770 def fix_url(key):
781 if keyvals.get(key): 771 if keyvals.get(key):
782 keyvals[key] = UpgradeToHttps(keyvals[key]) 772 keyvals[key] = UpgradeToHttps(keyvals[key])
783 fix_url('CODE_REVIEW_SERVER') 773 fix_url('CODE_REVIEW_SERVER')
784 fix_url('VIEW_VC') 774 fix_url('VIEW_VC')
785 return keyvals 775 return keyvals
OLDNEW
« 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