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

Side by Side Diff: gclient_utils.py

Issue 10103024: Check binary existence in gclient: 2nd try. (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
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 331 matching lines...) Expand 10 before | Expand all | Expand 10 after
342 342
343 Accepts all subprocess2.Popen() parameters plus: 343 Accepts all subprocess2.Popen() parameters plus:
344 print_stdout: If True, the command's stdout is forwarded to stdout. 344 print_stdout: If True, the command's stdout is forwarded to stdout.
345 filter_fn: A function taking a single string argument called with each line 345 filter_fn: A function taking a single string argument called with each line
346 of the subprocess2's output. Each line has the trailing newline 346 of the subprocess2's output. Each line has the trailing newline
347 character trimmed. 347 character trimmed.
348 stdout: Can be any bufferable output. 348 stdout: Can be any bufferable output.
349 349
350 stderr is always redirected to stdout. 350 stderr is always redirected to stdout.
351 """ 351 """
352 assert print_stdout or filter_fn 352 assert (print_stdout is not None) or filter_fn
353 stdout = stdout or sys.stdout 353 stdout = stdout or sys.stdout
354 filter_fn = filter_fn or (lambda x: None) 354 filter_fn = filter_fn or (lambda x: None)
355 kid = subprocess2.Popen( 355 kid = subprocess2.Popen(
356 args, bufsize=0, stdout=subprocess2.PIPE, stderr=subprocess2.STDOUT, 356 args, bufsize=0, stdout=subprocess2.PIPE, stderr=subprocess2.STDOUT,
357 **kwargs) 357 **kwargs)
358 358
359 # Do a flush of stdout before we begin reading from the subprocess2's stdout 359 # Do a flush of stdout before we begin reading from the subprocess2's stdout
360 stdout.flush() 360 stdout.flush()
361 361
362 # Also, we need to forward stdout to prevent weird re-ordering of output. 362 # Also, we need to forward stdout to prevent weird re-ordering of output.
(...skipping 403 matching lines...) Expand 10 before | Expand all | Expand 10 after
766 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)
767 except ValueError: 767 except ValueError:
768 raise Error( 768 raise Error(
769 'Failed to process settings, please fix. Content:\n\n%s' % content) 769 'Failed to process settings, please fix. Content:\n\n%s' % content)
770 def fix_url(key): 770 def fix_url(key):
771 if keyvals.get(key): 771 if keyvals.get(key):
772 keyvals[key] = UpgradeToHttps(keyvals[key]) 772 keyvals[key] = UpgradeToHttps(keyvals[key])
773 fix_url('CODE_REVIEW_SERVER') 773 fix_url('CODE_REVIEW_SERVER')
774 fix_url('VIEW_VC') 774 fix_url('VIEW_VC')
775 return keyvals 775 return keyvals
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698