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

Unified Diff: tools/observatory_tool.py

Issue 1337503003: Use the checked in SDK to build Observatory (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
« no previous file with comments | « runtime/observatory/observatory.gypi ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tools/observatory_tool.py
diff --git a/tools/observatory_tool.py b/tools/observatory_tool.py
index 66261438f1cb367603b3f8d0b4d883766836d9c2..776dbfffa6b481e855b1639f6d705914d924a95c 100755
--- a/tools/observatory_tool.py
+++ b/tools/observatory_tool.py
@@ -6,6 +6,7 @@
import argparse
import os
+import platform
import shutil
import subprocess
import sys
@@ -26,6 +27,25 @@ IGNORE_PATTERNS = shutil.ignore_patterns(
usage = """obs_tool.py [options]"""
+def GetDartSdkPubExecutablePath():
ricow1 2015/09/11 07:28:03 how about moving this to tools/utils.py so that we
+ osdict = {'Darwin':'mac', 'Linux':'linux', 'Windows':'win'}
+ system = platform.system()
+ executable_name = 'pub'
+ if system == 'Windows':
+ executable_name = 'pub.bat'
+ try:
+ osname = osdict[system]
+ except KeyError:
+ print >>sys.stderr, ('WARNING: platform "%s" not supported') % (system)
+ return None;
+ return os.path.join(DART_ROOT,
+ 'tools',
+ 'sdks',
+ osname,
+ 'dart-sdk',
+ 'bin',
+ executable_name)
+
def BuildArguments():
result = argparse.ArgumentParser(usage=usage)
result.add_argument("--package-root", help="package root", default=None)
@@ -34,6 +54,7 @@ def BuildArguments():
result.add_argument("--directory", help="observatory root", default=None)
result.add_argument("--command", help="[get, build, deploy]", default=None)
result.add_argument("--silent", help="silence all output", default=False)
+ result.add_argument("--sdk", help="Use prebuilt sdk", default=False)
return result
def ProcessOptions(options, args):
@@ -43,6 +64,10 @@ def ProcessOptions(options, args):
# If we have a pub executable, we are running from the dart-sdk.
if (options.pub_executable != None):
return True
+ if (options.sdk != None):
+ # Use the checked in pub executable by default.
+ options.pub_executable = GetDartSdkPubExecutablePath()
+ return True
# Otherwise, we need a dart executable and a package root.
return ((options.package_root != None) and
(options.dart_executable != None))
« no previous file with comments | « runtime/observatory/observatory.gypi ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698