OLD | NEW |
---|---|
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 321 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
332 return revision | 332 return revision |
333 | 333 |
334 # maybe the builder is using git-svn, try that | 334 # maybe the builder is using git-svn, try that |
335 p = subprocess.Popen(['git', 'svn', 'info'], stdout = subprocess.PIPE, | 335 p = subprocess.Popen(['git', 'svn', 'info'], stdout = subprocess.PIPE, |
336 stderr = subprocess.STDOUT, shell=IsWindows(), cwd = DART_DIR) | 336 stderr = subprocess.STDOUT, shell=IsWindows(), cwd = DART_DIR) |
337 output, _ = p.communicate() | 337 output, _ = p.communicate() |
338 revision = ParseSvnInfoOutput(output) | 338 revision = ParseSvnInfoOutput(output) |
339 if revision: | 339 if revision: |
340 return revision | 340 return revision |
341 | 341 |
342 # When building from tarball use tools/SVN_REVISION | |
343 svn_revision_file = os.path.join(DART_DIR, 'tools', 'SVN_REVISION') | |
kustermann
2014/02/06 15:28:04
You could make this a constant in utils.py add a c
| |
344 try: | |
345 with open(svn_revision_file) as fd | |
kustermann
2014/02/06 15:28:04
There is a colon missing here. I don't think this
| |
346 return fd.read() | |
347 except: | |
348 pass | |
349 | |
342 # Only fail on the buildbot in case of a SVN client version mismatch. | 350 # Only fail on the buildbot in case of a SVN client version mismatch. |
343 user = GetUserName() | 351 user = GetUserName() |
344 if user != 'chrome-bot': | 352 if user != 'chrome-bot': |
345 return '0' | 353 return '0' |
346 | 354 |
347 return None | 355 return None |
348 | 356 |
349 def ParseSvnInfoOutput(output): | 357 def ParseSvnInfoOutput(output): |
350 revision_match = re.search('Last Changed Rev: (\d+)', output) | 358 revision_match = re.search('Last Changed Rev: (\d+)', output) |
351 if revision_match: | 359 if revision_match: |
(...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
526 os.chdir(self._working_directory) | 534 os.chdir(self._working_directory) |
527 | 535 |
528 def __exit__(self, *_): | 536 def __exit__(self, *_): |
529 print "Enter directory = ", self._old_cwd | 537 print "Enter directory = ", self._old_cwd |
530 os.chdir(self._old_cwd) | 538 os.chdir(self._old_cwd) |
531 | 539 |
532 | 540 |
533 if __name__ == "__main__": | 541 if __name__ == "__main__": |
534 import sys | 542 import sys |
535 Main(sys.argv) | 543 Main(sys.argv) |
OLD | NEW |