| OLD | NEW |
| 1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
| 2 # | 2 # |
| 3 # Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 3 # Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file |
| 4 # for details. All rights reserved. Use of this source code is governed by a | 4 # for details. All rights reserved. Use of this source code is governed by a |
| 5 # BSD-style license that can be found in the LICENSE file. | 5 # BSD-style license that can be found in the LICENSE file. |
| 6 | 6 |
| 7 import hashlib | 7 import hashlib |
| 8 import imp | 8 import imp |
| 9 import os | 9 import os |
| 10 import platform | 10 import platform |
| 11 import string | 11 import string |
| 12 import subprocess | 12 import subprocess |
| 13 import sys | 13 import sys |
| 14 | 14 |
| 15 # The resource package does not exist on Windows but its functionality is not | |
| 16 # used there, either. | |
| 17 try: | |
| 18 import resource | |
| 19 except ImportError: | |
| 20 resource = None; | |
| 21 | |
| 22 DART_DIR = os.path.abspath( | 15 DART_DIR = os.path.abspath( |
| 23 os.path.normpath(os.path.join(__file__, '..', '..', '..'))) | 16 os.path.normpath(os.path.join(__file__, '..', '..', '..'))) |
| 24 | 17 |
| 25 def GetUtils(): | 18 def GetUtils(): |
| 26 '''Dynamically load the tools/utils.py python module.''' | 19 '''Dynamically load the tools/utils.py python module.''' |
| 27 return imp.load_source('utils', os.path.join(DART_DIR, 'tools', 'utils.py')) | 20 return imp.load_source('utils', os.path.join(DART_DIR, 'tools', 'utils.py')) |
| 28 | 21 |
| 29 SYSTEM_RENAMES = { | 22 SYSTEM_RENAMES = { |
| 30 'win32': 'windows', | 23 'win32': 'windows', |
| 31 'windows': 'windows', | 24 'windows': 'windows', |
| (...skipping 333 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 365 | 358 |
| 366 return checksum_filename | 359 return checksum_filename |
| 367 | 360 |
| 368 def GetChannelFromName(name): | 361 def GetChannelFromName(name): |
| 369 """Get the channel from the name. Bleeding edge builders don't | 362 """Get the channel from the name. Bleeding edge builders don't |
| 370 have a suffix.""" | 363 have a suffix.""" |
| 371 channel_name = string.split(name, '-').pop() | 364 channel_name = string.split(name, '-').pop() |
| 372 if channel_name in Channel.ALL_CHANNELS: | 365 if channel_name in Channel.ALL_CHANNELS: |
| 373 return channel_name | 366 return channel_name |
| 374 return Channel.BLEEDING_EDGE | 367 return Channel.BLEEDING_EDGE |
| 375 | |
| 376 class CoredumpEnabler(object): | |
| 377 def __init__(self): | |
| 378 self._old_limits = None | |
| 379 | |
| 380 def __enter__(self): | |
| 381 self._old_limits = resource.getrlimit(resource.RLIMIT_CORE) | |
| 382 resource.setrlimit(resource.RLIMIT_CORE, (-1, -1)) | |
| 383 | |
| 384 def __exit__(self, *_): | |
| 385 resource.setrlimit(resource.RLIMIT_CORE, self._old_limits) | |
| OLD | NEW |