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

Unified Diff: tools/utils.py

Issue 1342493003: Move CheckedInSdkPath helpers to utils (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') | 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 2301d9bd610fdb1398bab74c981bd4a046cbd279..bd83d45465ea2b633a4806afce6e8f32e7404fde 100644
--- a/tools/utils.py
+++ b/tools/utils.py
@@ -16,6 +16,9 @@ import subprocess
import tempfile
import sys
+SCRIPT_DIR = os.path.dirname(sys.argv[0])
ricow1 2015/09/14 05:46:41 we don't normally do this, see comment in function
Cutch 2015/09/14 14:05:43 Done.
+DART_ROOT = os.path.realpath(os.path.join(SCRIPT_DIR, '..'))
+
class Version(object):
def __init__(self, channel, major, minor, patch, prerelease,
prerelease_patch):
@@ -591,6 +594,29 @@ def DartSdkBinary():
dart_binary_prefix = os.path.join(tools_dir, '..', 'sdk' , 'bin')
return os.path.join(dart_binary_prefix, 'dart')
+
+def CheckedInSdkPath():
+ osdict = {'Darwin':'mac', 'Linux':'linux', 'Windows':'win'}
ricow1 2015/09/14 05:46:41 please add a comment here: # We don't use the norm
Cutch 2015/09/14 14:05:43 Done.
+ system = platform.system()
+ try:
+ osname = osdict[system]
+ except KeyError:
+ print >>sys.stderr, ('WARNING: platform "%s" not supported') % (system)
+ return None;
+ return os.path.join(DART_ROOT,
ricow1 2015/09/14 05:46:41 This seems to work better in general tools_dir = o
Cutch 2015/09/14 14:05:43 Done.
+ 'tools',
+ 'sdks',
+ osname,
+ 'dart-sdk')
+
+
+def CheckedInPubPath():
+ executable_name = 'pub'
+ if platform.system() == 'Windows':
+ executable_name = 'pub.bat'
+ return os.path.join(CheckedInSdkPath(), 'bin', executable_name)
+
+
class TempDir(object):
def __init__(self, prefix=''):
self._temp_dir = None
« no previous file with comments | « tools/observatory_tool.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698