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 |
15 DART_DIR = os.path.abspath( | 22 DART_DIR = os.path.abspath( |
16 os.path.normpath(os.path.join(__file__, '..', '..', '..'))) | 23 os.path.normpath(os.path.join(__file__, '..', '..', '..'))) |
17 | 24 |
18 def GetUtils(): | 25 def GetUtils(): |
19 '''Dynamically load the tools/utils.py python module.''' | 26 '''Dynamically load the tools/utils.py python module.''' |
20 return imp.load_source('utils', os.path.join(DART_DIR, 'tools', 'utils.py')) | 27 return imp.load_source('utils', os.path.join(DART_DIR, 'tools', 'utils.py')) |
21 | 28 |
22 SYSTEM_RENAMES = { | 29 SYSTEM_RENAMES = { |
23 'win32': 'windows', | 30 'win32': 'windows', |
24 'windows': 'windows', | 31 'windows': 'windows', |
(...skipping 333 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
358 | 365 |
359 return checksum_filename | 366 return checksum_filename |
360 | 367 |
361 def GetChannelFromName(name): | 368 def GetChannelFromName(name): |
362 """Get the channel from the name. Bleeding edge builders don't | 369 """Get the channel from the name. Bleeding edge builders don't |
363 have a suffix.""" | 370 have a suffix.""" |
364 channel_name = string.split(name, '-').pop() | 371 channel_name = string.split(name, '-').pop() |
365 if channel_name in Channel.ALL_CHANNELS: | 372 if channel_name in Channel.ALL_CHANNELS: |
366 return channel_name | 373 return channel_name |
367 return Channel.BLEEDING_EDGE | 374 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 |