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

Side by Side Diff: gclient_utils.py

Issue 503068: Make breakpad, gcl and presubmit_support dependencies optional (Closed)
Patch Set: Fix spurious error Created 11 years 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
« no previous file with comments | « gcl.py ('k') | tests/trychange_unittest.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 2009 Google Inc. All Rights Reserved. 1 # Copyright 2009 Google Inc. All Rights Reserved.
2 # 2 #
3 # Licensed under the Apache License, Version 2.0 (the "License"); 3 # Licensed under the Apache License, Version 2.0 (the "License");
4 # you may not use this file except in compliance with the License. 4 # you may not use this file except in compliance with the License.
5 # You may obtain a copy of the License at 5 # You may obtain a copy of the License at
6 # 6 #
7 # http://www.apache.org/licenses/LICENSE-2.0 7 # http://www.apache.org/licenses/LICENSE-2.0
8 # 8 #
9 # Unless required by applicable law or agreed to in writing, software 9 # Unless required by applicable law or agreed to in writing, software
10 # distributed under the License is distributed on an "AS IS" BASIS, 10 # distributed under the License is distributed on an "AS IS" BASIS,
(...skipping 17 matching lines...) Expand all
28 class CheckCallError(OSError): 28 class CheckCallError(OSError):
29 """CheckCall() returned non-0.""" 29 """CheckCall() returned non-0."""
30 def __init__(self, command, cwd, retcode, stdout): 30 def __init__(self, command, cwd, retcode, stdout):
31 OSError.__init__(self, command, cwd, retcode, stdout) 31 OSError.__init__(self, command, cwd, retcode, stdout)
32 self.command = command 32 self.command = command
33 self.cwd = cwd 33 self.cwd = cwd
34 self.retcode = retcode 34 self.retcode = retcode
35 self.stdout = stdout 35 self.stdout = stdout
36 36
37 37
38 def CheckCall(command, cwd=None): 38 def CheckCall(command, cwd=None, print_error=True):
39 """Like subprocess.check_call() but returns stdout. 39 """Like subprocess.check_call() but returns stdout.
40 40
41 Works on python 2.4 41 Works on python 2.4
42 """ 42 """
43 try: 43 try:
44 stderr = None
45 if not print_error:
46 stderr = subprocess.PIPE
44 process = subprocess.Popen(command, cwd=cwd, 47 process = subprocess.Popen(command, cwd=cwd,
45 shell=sys.platform.startswith('win'), 48 shell=sys.platform.startswith('win'),
46 stdout=subprocess.PIPE) 49 stdout=subprocess.PIPE,
50 stderr=stderr)
47 output = process.communicate()[0] 51 output = process.communicate()[0]
48 except OSError, e: 52 except OSError, e:
49 raise CheckCallError(command, cwd, errno, None) 53 raise CheckCallError(command, cwd, errno, None)
50 if process.returncode: 54 if process.returncode:
51 raise CheckCallError(command, cwd, process.returncode, output) 55 raise CheckCallError(command, cwd, process.returncode, output)
52 return output 56 return output
53 57
54 58
55 def SplitUrlRevision(url): 59 def SplitUrlRevision(url):
56 """Splits url and returns a two-tuple: url, rev""" 60 """Splits url and returns a two-tuple: url, rev"""
(...skipping 239 matching lines...) Expand 10 before | Expand all | Expand 10 after
296 raise Error(msg) 300 raise Error(msg)
297 301
298 302
299 def IsUsingGit(root, paths): 303 def IsUsingGit(root, paths):
300 """Returns True if we're using git to manage any of our checkouts. 304 """Returns True if we're using git to manage any of our checkouts.
301 |entries| is a list of paths to check.""" 305 |entries| is a list of paths to check."""
302 for path in paths: 306 for path in paths:
303 if os.path.exists(os.path.join(root, path, '.git')): 307 if os.path.exists(os.path.join(root, path, '.git')):
304 return True 308 return True
305 return False 309 return False
OLDNEW
« no previous file with comments | « gcl.py ('k') | tests/trychange_unittest.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698