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

Side by Side Diff: tools/utils.py

Issue 11143010: Update revision info to version info for dart2js et al. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 8 years, 2 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « tools/create_sdk.py ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 # Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file 1 # Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
2 # for details. All rights reserved. Use of this source code is governed by a 2 # for details. All rights reserved. Use of this source code is governed by a
3 # BSD-style license that can be found in the LICENSE file. 3 # BSD-style license that can be found in the LICENSE file.
4 4
5 # This file contains a set of utilities functions used by other Python-based 5 # This file contains a set of utilities functions used by other Python-based
6 # scripts. 6 # scripts.
7 7
8 import commands 8 import commands
9 import os 9 import os
10 import platform 10 import platform
(...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after
145 145
146 def GetBuildRoot(host_os, mode=None, arch=None, target_os=None): 146 def GetBuildRoot(host_os, mode=None, arch=None, target_os=None):
147 build_root = GetBuildDir(host_os, target_os) 147 build_root = GetBuildDir(host_os, target_os)
148 if mode: 148 if mode:
149 build_root = os.path.join(build_root, GetBuildConf(mode, arch)) 149 build_root = os.path.join(build_root, GetBuildConf(mode, arch))
150 return build_root 150 return build_root
151 151
152 def GetBaseDir(): 152 def GetBaseDir():
153 return BASE_DIR 153 return BASE_DIR
154 154
155 def GetVersion():
156 dartbin = DartBinary()
157 version_script = VersionScript()
158 p = subprocess.Popen([dartbin, version_script], stdout = subprocess.PIPE,
159 stderr = subprocess.STDOUT, shell=IsWindows())
160 output, not_used = p.communicate()
161 return output.strip()
162
155 def GetSVNRevision(): 163 def GetSVNRevision():
156 p = subprocess.Popen(['svn', 'info'], stdout = subprocess.PIPE, 164 p = subprocess.Popen(['svn', 'info'], stdout = subprocess.PIPE,
157 stderr = subprocess.STDOUT, shell=IsWindows()) 165 stderr = subprocess.STDOUT, shell=IsWindows())
158 output, not_used = p.communicate() 166 output, not_used = p.communicate()
159 revision = ParseSvnInfoOutput(output) 167 revision = ParseSvnInfoOutput(output)
160 if revision: 168 if revision:
161 return revision 169 return revision
162 170
163 # maybe the builder is using git-svn, try that 171 # maybe the builder is using git-svn, try that
164 p = subprocess.Popen(['git', 'svn', 'info'], stdout = subprocess.PIPE, 172 p = subprocess.Popen(['git', 'svn', 'info'], stdout = subprocess.PIPE,
(...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after
290 if IsCrashExitCode(exit_code): 298 if IsCrashExitCode(exit_code):
291 sys.stderr.write('Command: %s\nCRASHED with exit code %d (0x%x)\n' % ( 299 sys.stderr.write('Command: %s\nCRASHED with exit code %d (0x%x)\n' % (
292 ' '.join(command), exit_code, exit_code & 0xffffffff)) 300 ' '.join(command), exit_code, exit_code & 0xffffffff))
293 301
294 302
295 def Touch(name): 303 def Touch(name):
296 with file(name, 'a'): 304 with file(name, 'a'):
297 os.utime(name, None) 305 os.utime(name, None)
298 306
299 307
308 def VersionScript():
309 tools_dir = os.path.dirname(os.path.realpath(__file__))
310 return os.path.join(tools_dir, 'version.dart')
311
312
300 def DartBinary(): 313 def DartBinary():
301 tools_dir = os.path.dirname(os.path.realpath(__file__)) 314 tools_dir = os.path.dirname(os.path.realpath(__file__))
302 dart_binary_prefix = os.path.join(tools_dir, 'testing', 'bin') 315 dart_binary_prefix = os.path.join(tools_dir, 'testing', 'bin')
303 if IsWindows(): 316 if IsWindows():
304 return os.path.join(dart_binary_prefix, 'windows', 'dart.exe') 317 return os.path.join(dart_binary_prefix, 'windows', 'dart.exe')
305 else: 318 else:
306 return os.path.join(dart_binary_prefix, GuessOS(), 'dart') 319 return os.path.join(dart_binary_prefix, GuessOS(), 'dart')
307 320
308 321
309 if __name__ == "__main__": 322 if __name__ == "__main__":
310 import sys 323 import sys
311 Main(sys.argv) 324 Main(sys.argv)
OLDNEW
« no previous file with comments | « tools/create_sdk.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698