Chromium Code Reviews| 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 |