Chromium Code Reviews| 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') | |
| 344 try: | |
| 345 fd = open(svn_revision_file) | |
|
ricow1
2014/02/06 13:25:21
I am a sucker for with :-)
try:
with open(svn_re
Søren Gjesse
2014/02/07 09:52:43
Done.
| |
| 346 content = fd.read() | |
| 347 fd.close() | |
| 348 return content | |
| 349 except: | |
| 350 pass | |
| 351 | |
| 342 # Only fail on the buildbot in case of a SVN client version mismatch. | 352 # Only fail on the buildbot in case of a SVN client version mismatch. |
| 343 user = GetUserName() | 353 user = GetUserName() |
| 344 if user != 'chrome-bot': | 354 if user != 'chrome-bot': |
| 345 return '0' | 355 return '0' |
| 346 | 356 |
| 347 return None | 357 return None |
| 348 | 358 |
| 349 def ParseSvnInfoOutput(output): | 359 def ParseSvnInfoOutput(output): |
| 350 revision_match = re.search('Last Changed Rev: (\d+)', output) | 360 revision_match = re.search('Last Changed Rev: (\d+)', output) |
| 351 if revision_match: | 361 if revision_match: |
| (...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 526 os.chdir(self._working_directory) | 536 os.chdir(self._working_directory) |
| 527 | 537 |
| 528 def __exit__(self, *_): | 538 def __exit__(self, *_): |
| 529 print "Enter directory = ", self._old_cwd | 539 print "Enter directory = ", self._old_cwd |
| 530 os.chdir(self._old_cwd) | 540 os.chdir(self._old_cwd) |
| 531 | 541 |
| 532 | 542 |
| 533 if __name__ == "__main__": | 543 if __name__ == "__main__": |
| 534 import sys | 544 import sys |
| 535 Main(sys.argv) | 545 Main(sys.argv) |
| OLD | NEW |