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

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: 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
« tools/run_pub.py ('K') | « 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..9687fc2ed7783de770521e9b91c07ea5228c5798 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
Ivan Posva 2015/09/15 17:01:42 ditto: --
Bill Hesse 2015/09/15 17:09:02 This is the URL of the page. I tracked it down, a
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,6 +612,34 @@ def CheckedInSdkPath():
'dart-sdk')
+def CheckedInSdkExecutable():
+ return os.path.join(CheckedInSdkPath(),
+ 'bin',
+ 'dart.exe' if IsWindows() else 'dart')
+
+
+def CheckedInSdkFixExecutable():
Ivan Posva 2015/09/15 17:01:42 The documentation talks about a CheckedInSdkFixedE
Bill Hesse 2015/09/15 17:09:02 I like Fix, because it is an active verb, and this
Bill Hesse 2015/09/21 10:05:06 Changed to CheckedInSdkCheckExecutable, since it n
+ 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
+ arch = GuessArchitecture()
+ system = GuessOS()
+ if system == 'linux' and (arch == 'mips' or arch == 'arm'):
+ try:
+ shutil.copy(os.path.join(CheckedInSdkPath(), 'bin', 'dart-%s' % arch),
+ executable)
Ivan Posva 2015/09/15 17:01:42 Here you are overwriting the ia32 executable which
Bill Hesse 2015/09/15 17:09:02 We are already changing the source repository by c
Bill Hesse 2015/09/15 22:37:05 We can avoid doing this, if you absolutely don't w
Bill Hesse 2015/09/15 22:37:05 For testing purposes, I added a dart-ia32 binary t
Ivan Posva 2015/09/15 23:32:59 Summarizing offline discussion here: Specifying a
Bill Hesse 2015/09/21 10:05:06 Done.
+ if 42 == subprocess.call([executable, canary_script]):
+ return True
+ except (OSError, IOError) as e:
+ pass
+ return False
+
+
def CheckedInPubPath():
executable_name = 'pub'
if platform.system() == 'Windows':
« tools/run_pub.py ('K') | « tools/run_pub.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698