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

Unified Diff: tools/utils.py

Issue 1343103002: Observatory build should try backup method if the SDK doesn't work. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Address comments Created 5 years, 3 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 | « tools/run_pub.py ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tools/utils.py
diff --git a/tools/utils.py b/tools/utils.py
index ae04a53801880e84b69f6253c8567df1cf593ff9..4b7fae5794ef8dd4dede98f5c1a09c68f90d7192 100644
--- a/tools/utils.py
+++ b/tools/utils.py
@@ -565,6 +565,7 @@ def ExecuteCommand(cmd):
def DartBinary():
+ # TODO(24311): Replace all uses of this with CheckedInSdk[Fix]Executable().
tools_dir = os.path.dirname(os.path.realpath(__file__))
dart_binary_prefix = os.path.join(tools_dir, 'testing', 'bin')
if IsWindows():
@@ -592,6 +593,8 @@ def DartSdkBinary():
return os.path.join(dart_binary_prefix, 'dart')
+# The checked-in SDKs are documented at
+# https://github.com/dart-lang/sdk/wiki/The-checked-in-SDK-in-tools
def CheckedInSdkPath():
# We don't use the normal macos, linux, win32 directory names here, instead,
# we use the names that the download_from_google_storage script uses.
@@ -609,11 +612,29 @@ def CheckedInSdkPath():
'dart-sdk')
-def CheckedInPubPath():
- executable_name = 'pub'
- if platform.system() == 'Windows':
- executable_name = 'pub.bat'
- return os.path.join(CheckedInSdkPath(), 'bin', executable_name)
+def CheckedInSdkExecutable():
+ name = 'dart'
+ if IsWindows():
+ name = 'dart.exe'
+ elif GuessOS() == 'linux':
+ arch = GuessArchitecture()
+ if arch == 'mips':
+ name = 'dart-mips'
+ elif arch == 'arm':
+ name = 'dart-arm'
+ return os.path.join(CheckedInSdkPath(), 'bin', name)
+
+
+def CheckedInSdkCheckExecutable():
+ executable = CheckedInSdkExecutable()
+ canary_script = os.path.join(os.path.dirname(os.path.realpath(__file__)),
+ 'canary.dart')
+ try:
+ if 42 == subprocess.call([executable, canary_script]):
+ return True
+ except OSError as e:
+ pass
+ return False
class TempDir(object):
« no previous file with comments | « tools/run_pub.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698