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

Unified Diff: tools/run_pub.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
« no previous file with comments | « tools/observatory_tool.py ('k') | tools/utils.py » ('j') | tools/utils.py » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tools/run_pub.py
diff --git a/tools/run_pub.py b/tools/run_pub.py
index f54a411701699a29133cdc16de25fddd1c86dc25..94e571c243c3e086121a69cd90004b0169ef0744 100755
--- a/tools/run_pub.py
+++ b/tools/run_pub.py
@@ -13,7 +13,6 @@ import sys
SCRIPT_DIR = os.path.dirname(sys.argv[0])
DART_ROOT = os.path.realpath(os.path.join(SCRIPT_DIR, '..'))
PUB_PATH = os.path.join(DART_ROOT, 'third_party/pkg/pub/bin/pub.dart')
-CANARY_PATH = os.path.join(DART_ROOT, 'tools', 'canary.dart')
usage = """run_pub.py --package-root=<package root>"""
@@ -27,67 +26,21 @@ def ProcessOptions(options, args):
return ((options.package_root != None) and
(options.dart_executable != None))
-def GetPrebuiltDartExecutablePath(suffix):
- osdict = {'Darwin':'macos', 'Linux':'linux', 'Windows':'windows'}
- system = platform.system()
- executable_name = 'dart'
- if system == 'Windows':
- executable_name = 'dart.exe'
- try:
- osname = osdict[system]
- except KeyError:
- print >>sys.stderr, ('WARNING: platform "%s" not supported') % (system)
- return None;
- return os.path.join(DART_ROOT,
- 'tools',
- 'testing',
- 'bin',
- osname,
- executable_name + suffix)
-
def RunPub(dart, pkg_root, args):
return subprocess.call([dart, '--package-root=' + pkg_root, PUB_PATH] + args)
-def TryRunningExecutable(dart_executable, pkg_root):
- try:
- return subprocess.call([dart_executable,
- '--package-root=' + pkg_root,
- CANARY_PATH]) == 42
- except:
- return False;
def DisplayBootstrapWarning():
print """\
-WARNING: Your system cannot run the prebuilt Dart executable. Using the
-bootstrap Dart executable will make Debug builds long.
-Please see Wiki for instructions on replacing prebuilt Dart executable.
-
-https://code.google.com/p/dart/wiki/ReplacingPrebuiltDartExecutable
+WARNING: Your system cannot run the checked-in Dart SDK. Using the
+bootstrap Dart SDK will make debug builds slow.
+Please see the Wiki for instructions on replacing the checked-in Dart SDK.
+https://github.com/dart-lang/sdk/wiki/The-checked-in-SDK-in--tools
Ivan Posva 2015/09/15 17:01:42 Why the double -- between "in" and "tools"?
Bill Hesse 2015/09/15 17:09:02 Done.
"""
-def FindDartExecutable(fallback_executable, package_root):
- # If requested, use the bootstrap binary instead of the prebuilt
- # executable.
- if os.getenv('DART_USE_BOOTSTRAP_BIN') != None:
- return fallback_executable
- # Try to find a working prebuilt dart executable.
- dart_executable = GetPrebuiltDartExecutablePath('')
- if TryRunningExecutable(dart_executable, package_root):
- return dart_executable
- dart_executable = GetPrebuiltDartExecutablePath('-arm')
- if TryRunningExecutable(dart_executable, package_root):
- return dart_executable
- dart_executable = GetPrebuiltDartExecutablePath('-mips')
- if TryRunningExecutable(dart_executable, package_root):
- return dart_executable
- # If the system cannot execute a prebuilt dart executable, use the bootstrap
- # executable instead.
- DisplayBootstrapWarning()
- return fallback_executable
-
def main():
# Parse the options.
parser = BuildArguments()
@@ -95,9 +48,8 @@ def main():
if not ProcessOptions(options, args):
parser.print_help()
return 1
- dart_executable = FindDartExecutable(options.dart_executable,
- options.package_root)
- return RunPub(dart_executable, options.package_root, args)
+ DisplayBootstrapWarning()
+ return RunPub(options.dart_executable, options.package_root, args)
if __name__ == '__main__':
« no previous file with comments | « tools/observatory_tool.py ('k') | tools/utils.py » ('j') | tools/utils.py » ('J')

Powered by Google App Engine
This is Rietveld 408576698