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

Unified Diff: mojo/devtools/common/devtoolslib/paths.py

Issue 1581773005: mojo_run: infer --origin from `MOJO_VERSION` file if present. (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Add a verbose printout. Created 4 years, 11 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | mojo/devtools/common/devtoolslib/shell_config.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: mojo/devtools/common/devtoolslib/paths.py
diff --git a/mojo/devtools/common/devtoolslib/paths.py b/mojo/devtools/common/devtoolslib/paths.py
index 502636a06d7681b0ddc2c59110e80474178da6ad..8c592aea2decb4e99cfdebde8baa14fe7ca4706b 100644
--- a/mojo/devtools/common/devtoolslib/paths.py
+++ b/mojo/devtools/common/devtoolslib/paths.py
@@ -37,7 +37,7 @@ def find_within_ancestors(target_relpath, start_path=None):
return os.path.join(ancestor, target_relpath)
-def infer_paths(is_android, is_debug, target_cpu):
+def infer_params(is_android, is_debug, target_cpu):
"""Infers the locations of select build output artifacts in a regular
Chromium-like checkout. This should grow thinner or disappear as we introduce
per-repo config files, see https://github.com/domokit/devtools/issues/28.
@@ -51,19 +51,24 @@ def infer_paths(is_android, is_debug, target_cpu):
out_build_dir = os.path.join('out', build_dir)
root_path = find_ancestor_with(out_build_dir)
- paths = collections.defaultdict(lambda: None)
+ params = collections.defaultdict(lambda: None)
if not root_path:
- return paths
+ return params
build_dir_path = os.path.join(root_path, out_build_dir)
- paths['build_dir_path'] = build_dir_path
+ params['build_dir_path'] = build_dir_path
if is_android:
- paths['shell_path'] = os.path.join(build_dir_path, 'apks', 'MojoShell.apk')
- paths['adb_path'] = os.path.join(root_path, 'third_party', 'android_tools',
+ params['shell_path'] = os.path.join(build_dir_path, 'apks', 'MojoShell.apk')
+ params['adb_path'] = os.path.join(root_path, 'third_party', 'android_tools',
'sdk', 'platform-tools', 'adb')
else:
- paths['shell_path'] = os.path.join(build_dir_path, 'mojo_shell')
- return paths
+ params['shell_path'] = os.path.join(build_dir_path, 'mojo_shell')
+
+ mojo_version_file = find_within_ancestors('MOJO_VERSION')
+ if mojo_version_file:
+ with open(mojo_version_file) as f:
+ params['mojo_version'] = f.read().strip()
+ return params
# Based on Chromium //tools/find_depot_tools.py.
« no previous file with comments | « no previous file | mojo/devtools/common/devtoolslib/shell_config.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698