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

Side by Side Diff: mojo/devtools/common/devtoolslib/paths.py

Issue 1844943004: devtools: download shell binaries and set origin when run w/ --mojo-version. (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 4 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
OLDNEW
1 # Copyright 2015 The Chromium Authors. All rights reserved. 1 # Copyright 2015 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 """Supports inferring locations of files in default checkout layouts. 5 """Supports inferring locations of files in default checkout layouts.
6 6
7 These functions allow devtools scripts to work out-of-the-box with regular Mojo 7 These functions allow devtools scripts to work out-of-the-box with regular Mojo
8 checkouts. 8 checkouts.
9 """ 9 """
10 10
11 import collections 11 import collections
12 import os.path 12 import os.path
13 import sys 13 import sys
14 14
15 DEVTOOLS_ROOT = os.path.join(os.path.dirname(os.path.realpath(__file__)), '..')
16
15 17
16 def find_ancestor_with(relpath, start_path=None): 18 def find_ancestor_with(relpath, start_path=None):
17 """Returns the lowest ancestor of this file that contains |relpath|.""" 19 """Returns the lowest ancestor of this file that contains |relpath|."""
18 cur_dir_path = start_path or os.path.abspath(os.path.dirname(__file__)) 20 cur_dir_path = start_path or os.path.abspath(os.path.dirname(__file__))
19 while True: 21 while True:
20 if os.path.exists(os.path.join(cur_dir_path, relpath)): 22 if os.path.exists(os.path.join(cur_dir_path, relpath)):
21 return cur_dir_path 23 return cur_dir_path
22 24
23 next_dir_path = os.path.dirname(cur_dir_path) 25 next_dir_path = os.path.dirname(cur_dir_path)
24 if next_dir_path != cur_dir_path: 26 if next_dir_path != cur_dir_path:
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
94 # Rare case, it's not even in PATH, look upward up to root. 96 # Rare case, it's not even in PATH, look upward up to root.
95 root_dir = os.path.dirname(os.path.abspath(__file__)) 97 root_dir = os.path.dirname(os.path.abspath(__file__))
96 previous_dir = os.path.abspath(__file__) 98 previous_dir = os.path.abspath(__file__)
97 while root_dir and root_dir != previous_dir: 99 while root_dir and root_dir != previous_dir:
98 i = os.path.join(root_dir, 'depot_tools') 100 i = os.path.join(root_dir, 'depot_tools')
99 if _is_real_depot_tools(i): 101 if _is_real_depot_tools(i):
100 return i 102 return i
101 previous_dir = root_dir 103 previous_dir = root_dir
102 root_dir = os.path.dirname(root_dir) 104 root_dir = os.path.dirname(root_dir)
103 return None 105 return None
OLDNEW
« no previous file with comments | « mojo/devtools/common/devtoolslib/download.py ('k') | mojo/devtools/common/devtoolslib/shell_arguments.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698