| 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 | 7 |
| 8 import optparse | 8 import optparse |
| 9 import os | 9 import os |
| 10 import re | 10 import re |
| (...skipping 315 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 326 # Use AppleScript to display a UI non-modal notification. | 326 # Use AppleScript to display a UI non-modal notification. |
| 327 script = 'display notification "%s" with title "%s" sound name "Glass"' % ( | 327 script = 'display notification "%s" with title "%s" sound name "Glass"' % ( |
| 328 message, title) | 328 message, title) |
| 329 command = "osascript -e '%s' &" % script | 329 command = "osascript -e '%s' &" % script |
| 330 elif HOST_OS == 'linux': | 330 elif HOST_OS == 'linux': |
| 331 if success: | 331 if success: |
| 332 icon = 'dialog-information' | 332 icon = 'dialog-information' |
| 333 else: | 333 else: |
| 334 icon = 'dialog-error' | 334 icon = 'dialog-error' |
| 335 command = "notify-send -i '%s' '%s' '%s' &" % (icon, message, title) | 335 command = "notify-send -i '%s' '%s' '%s' &" % (icon, message, title) |
| 336 elif HOST_OS == 'win32': |
| 337 if success: |
| 338 icon = 'info' |
| 339 else: |
| 340 icon = 'error' |
| 341 command = ("powershell -command \"" |
| 342 "[reflection.assembly]::loadwithpartialname('System.Windows.Forms')" |
| 343 "| Out-Null;" |
| 344 "[reflection.assembly]::loadwithpartialname('System.Drawing')" |
| 345 "| Out-Null;" |
| 346 "$n = new-object system.windows.forms.notifyicon;" |
| 347 "$n.icon = [system.drawing.systemicons]::information;" |
| 348 "$n.visible = $true;" |
| 349 "$n.showballoontip(%d, '%s', '%s', " |
| 350 "[system.windows.forms.tooltipicon]::%s);\"") % ( |
| 351 5000, # Notification stays on for this many milliseconds |
| 352 message, title, icon) |
| 336 | 353 |
| 337 if command: | 354 if command: |
| 338 # Ignore return code, if this command fails, it doesn't matter. | 355 # Ignore return code, if this command fails, it doesn't matter. |
| 339 os.system(command) | 356 os.system(command) |
| 340 | 357 |
| 341 | 358 |
| 342 def Main(): | 359 def Main(): |
| 343 utils.ConfigureJava() | 360 utils.ConfigureJava() |
| 344 # Parse the options. | 361 # Parse the options. |
| 345 parser = BuildOptions() | 362 parser = BuildOptions() |
| (...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 446 NotifyBuildDone(build_config, success=False, start=start_time) | 463 NotifyBuildDone(build_config, success=False, start=start_time) |
| 447 return 1 | 464 return 1 |
| 448 else: | 465 else: |
| 449 NotifyBuildDone(build_config, success=True, start=start_time) | 466 NotifyBuildDone(build_config, success=True, start=start_time) |
| 450 | 467 |
| 451 return 0 | 468 return 0 |
| 452 | 469 |
| 453 | 470 |
| 454 if __name__ == '__main__': | 471 if __name__ == '__main__': |
| 455 sys.exit(Main()) | 472 sys.exit(Main()) |
| OLD | NEW |