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

Unified Diff: build/android/devil/android/sdk/build_tools.py

Issue 1416703003: [Android] Add a configurable environment for devil/. (RELAND 2) (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase Created 5 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « build/android/devil/android/sdk/adb_wrapper.py ('k') | build/android/devil/android/sdk/dexdump.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: build/android/devil/android/sdk/build_tools.py
diff --git a/build/android/devil/android/sdk/build_tools.py b/build/android/devil/android/sdk/build_tools.py
new file mode 100644
index 0000000000000000000000000000000000000000..6965dd43547ead9d2ff6dc789b73340c30d75cc4
--- /dev/null
+++ b/build/android/devil/android/sdk/build_tools.py
@@ -0,0 +1,51 @@
+# Copyright 2015 The Chromium Authors. All rights reserved.
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+
+import os
+
+from devil import devil_env
+from devil.utils import lazy
+
+with devil_env.SysPath(devil_env.CATAPULT_BASE_PATH):
+ from catapult_base import dependency_manager # pylint: disable=import-error
+
+
+def GetPath(build_tool):
+ try:
+ return devil_env.config.LocalPath(build_tool)
+ except dependency_manager.NoPathFoundError:
+ pass
+
+ try:
+ return _PathInLocalSdk(build_tool)
+ except dependency_manager.NoPathFoundError:
+ pass
+
+ return devil_env.config.FetchPath(build_tool)
+
+
+def _PathInLocalSdk(build_tool):
+ build_tools_path = _build_tools_path.read()
+ return (os.path.join(build_tools_path, build_tool) if build_tools_path
+ else None)
+
+
+def _FindBuildTools():
+ android_sdk_path = devil_env.config.LocalPath('android_sdk')
+ if not android_sdk_path:
+ return None
+
+ build_tools_contents = os.listdir(
+ os.path.join(android_sdk_path, 'build-tools'))
+
+ if not build_tools_contents:
+ return None
+ else:
+ if len(build_tools_contents) > 1:
+ build_tools_contents.sort()
+ return os.path.join(android_sdk_path, 'build-tools',
+ build_tools_contents[-1])
+
+
+_build_tools_path = lazy.WeakConstant(_FindBuildTools)
« no previous file with comments | « build/android/devil/android/sdk/adb_wrapper.py ('k') | build/android/devil/android/sdk/dexdump.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698