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

Side by Side Diff: tools/find_depot_tools.py

Issue 652893005: Look for gclient.py in find_depot_tools (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 2 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
« no previous file with comments | « no previous file | no next file » | 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) 2011 The Chromium Authors. All rights reserved. 1 # Copyright (c) 2011 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 """Small utility function to find depot_tools and add it to the python path. 4 """Small utility function to find depot_tools and add it to the python path.
5 5
6 Will throw an ImportError exception if depot_tools can't be found since it 6 Will throw an ImportError exception if depot_tools can't be found since it
7 imports breakpad. 7 imports breakpad.
8 """ 8 """
9 9
10 import os 10 import os
11 import sys 11 import sys
12 12
13 13
14 def IsRealDepotTools(path): 14 def IsRealDepotTools(path):
15 return os.path.isfile(os.path.join(path, 'gclient')) 15 return os.path.isfile(os.path.join(path, 'gclient.py'))
16 16
17 17
18 def add_depot_tools_to_path(): 18 def add_depot_tools_to_path():
19 """Search for depot_tools and add it to sys.path.""" 19 """Search for depot_tools and add it to sys.path."""
20 # First look if depot_tools is already in PYTHONPATH. 20 # First look if depot_tools is already in PYTHONPATH.
21 for i in sys.path: 21 for i in sys.path:
22 if i.rstrip(os.sep).endswith('depot_tools') and IsRealDepotTools(i): 22 if i.rstrip(os.sep).endswith('depot_tools') and IsRealDepotTools(i):
23 return i 23 return i
24 # Then look if depot_tools is in PATH, common case. 24 # Then look if depot_tools is in PATH, common case.
25 for i in os.environ['PATH'].split(os.pathsep): 25 for i in os.environ['PATH'].split(os.pathsep):
(...skipping 10 matching lines...) Expand all
36 return i 36 return i
37 previous_dir = root_dir 37 previous_dir = root_dir
38 root_dir = os.path.dirname(root_dir) 38 root_dir = os.path.dirname(root_dir)
39 print >> sys.stderr, 'Failed to find depot_tools' 39 print >> sys.stderr, 'Failed to find depot_tools'
40 return None 40 return None
41 41
42 add_depot_tools_to_path() 42 add_depot_tools_to_path()
43 43
44 # pylint: disable=W0611 44 # pylint: disable=W0611
45 import breakpad 45 import breakpad
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698