| OLD | NEW |
| 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 |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 52 | 52 |
| 53 root_path = find_ancestor_with(out_build_dir) | 53 root_path = find_ancestor_with(out_build_dir) |
| 54 params = collections.defaultdict(lambda: None) | 54 params = collections.defaultdict(lambda: None) |
| 55 if not root_path: | 55 if not root_path: |
| 56 return params | 56 return params |
| 57 | 57 |
| 58 build_dir_path = os.path.join(root_path, out_build_dir) | 58 build_dir_path = os.path.join(root_path, out_build_dir) |
| 59 params['build_dir_path'] = build_dir_path | 59 params['build_dir_path'] = build_dir_path |
| 60 if is_android: | 60 if is_android: |
| 61 params['shell_path'] = os.path.join(build_dir_path, 'apks', 'MojoShell.apk') | 61 params['shell_path'] = os.path.join(build_dir_path, 'apks', 'MojoShell.apk') |
| 62 params['adb_path'] = os.path.join(root_path, 'third_party', 'android_tools', | 62 adb_path = os.path.join(root_path, 'third_party', 'android_tools', |
| 63 'sdk', 'platform-tools', 'adb') | 63 'sdk', 'platform-tools', 'adb') |
| 64 if os.path.isfile(adb_path): |
| 65 params['adb_path'] = adb_path |
| 64 else: | 66 else: |
| 65 params['shell_path'] = os.path.join(build_dir_path, 'mojo_shell') | 67 params['shell_path'] = os.path.join(build_dir_path, 'mojo_shell') |
| 66 | 68 |
| 67 mojo_version_file = find_within_ancestors('MOJO_VERSION') | 69 mojo_version_file = find_within_ancestors('MOJO_VERSION') |
| 68 if mojo_version_file: | 70 if mojo_version_file: |
| 69 with open(mojo_version_file) as f: | 71 with open(mojo_version_file) as f: |
| 70 params['mojo_version'] = f.read().strip() | 72 params['mojo_version'] = f.read().strip() |
| 71 return params | 73 return params |
| 72 | 74 |
| 73 | 75 |
| (...skipping 18 matching lines...) Expand all Loading... |
| 92 # Rare case, it's not even in PATH, look upward up to root. | 94 # Rare case, it's not even in PATH, look upward up to root. |
| 93 root_dir = os.path.dirname(os.path.abspath(__file__)) | 95 root_dir = os.path.dirname(os.path.abspath(__file__)) |
| 94 previous_dir = os.path.abspath(__file__) | 96 previous_dir = os.path.abspath(__file__) |
| 95 while root_dir and root_dir != previous_dir: | 97 while root_dir and root_dir != previous_dir: |
| 96 i = os.path.join(root_dir, 'depot_tools') | 98 i = os.path.join(root_dir, 'depot_tools') |
| 97 if _is_real_depot_tools(i): | 99 if _is_real_depot_tools(i): |
| 98 return i | 100 return i |
| 99 previous_dir = root_dir | 101 previous_dir = root_dir |
| 100 root_dir = os.path.dirname(root_dir) | 102 root_dir = os.path.dirname(root_dir) |
| 101 return None | 103 return None |
| OLD | NEW |