| OLD | NEW |
| 1 # Copyright (c) 2009, Google Inc. All rights reserved. | 1 # Copyright (c) 2009, Google Inc. All rights reserved. |
| 2 # | 2 # |
| 3 # Redistribution and use in source and binary forms, with or without | 3 # Redistribution and use in source and binary forms, with or without |
| 4 # modification, are permitted provided that the following conditions are | 4 # modification, are permitted provided that the following conditions are |
| 5 # met: | 5 # met: |
| 6 # | 6 # |
| 7 # * Redistributions of source code must retain the above copyright | 7 # * Redistributions of source code must retain the above copyright |
| 8 # notice, this list of conditions and the following disclaimer. | 8 # notice, this list of conditions and the following disclaimer. |
| 9 # * Redistributions in binary form must reproduce the above | 9 # * Redistributions in binary form must reproduce the above |
| 10 # copyright notice, this list of conditions and the following disclaimer | 10 # copyright notice, this list of conditions and the following disclaimer |
| (...skipping 20 matching lines...) Expand all Loading... |
| 31 import os | 31 import os |
| 32 import platform | 32 import platform |
| 33 import re | 33 import re |
| 34 import shlex | 34 import shlex |
| 35 import subprocess | 35 import subprocess |
| 36 import sys | 36 import sys |
| 37 import webbrowser | 37 import webbrowser |
| 38 | 38 |
| 39 from webkitpy.common.system.executive import Executive | 39 from webkitpy.common.system.executive import Executive |
| 40 from webkitpy.common.system.filesystem import FileSystem | 40 from webkitpy.common.system.filesystem import FileSystem |
| 41 from webkitpy.common.system.platforminfo import PlatformInfo | 41 from webkitpy.common.system.platform_info import PlatformInfo |
| 42 | 42 |
| 43 | 43 |
| 44 _log = logging.getLogger(__name__) | 44 _log = logging.getLogger(__name__) |
| 45 | 45 |
| 46 | 46 |
| 47 class User(object): | 47 class User(object): |
| 48 DEFAULT_NO = 'n' | 48 DEFAULT_NO = 'n' |
| 49 DEFAULT_YES = 'y' | 49 DEFAULT_YES = 'y' |
| 50 | 50 |
| 51 def __init__(self, platforminfo=None): | 51 def __init__(self, platform_info=None): |
| 52 # We cannot get the PlatformInfo object from a SystemHost because | 52 # We cannot get the PlatformInfo object from a SystemHost because |
| 53 # User is part of SystemHost itself. | 53 # User is part of SystemHost itself. |
| 54 self._platforminfo = platforminfo or PlatformInfo(sys, platform, FileSys
tem(), Executive()) | 54 self._platform_info = platform_info or PlatformInfo(sys, platform, FileS
ystem(), Executive()) |
| 55 | 55 |
| 56 # FIXME: These are @classmethods because bugzilla.py doesn't have a Tool obj
ect (thus no User instance). | 56 # FIXME: These are @classmethods because bugzilla.py doesn't have a Tool obj
ect (thus no User instance). |
| 57 @classmethod | 57 @classmethod |
| 58 def prompt(cls, message, repeat=1, raw_input=raw_input): | 58 def prompt(cls, message, repeat=1, raw_input=raw_input): |
| 59 response = None | 59 response = None |
| 60 while repeat and not response: | 60 while repeat and not response: |
| 61 repeat -= 1 | 61 repeat -= 1 |
| 62 response = raw_input(message) | 62 response = raw_input(message) |
| 63 return response | 63 return response |
| 64 | 64 |
| (...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 144 try: | 144 try: |
| 145 webbrowser.get() | 145 webbrowser.get() |
| 146 return True | 146 return True |
| 147 except webbrowser.Error: | 147 except webbrowser.Error: |
| 148 return False | 148 return False |
| 149 | 149 |
| 150 def open_url(self, url): | 150 def open_url(self, url): |
| 151 if not self.can_open_url(): | 151 if not self.can_open_url(): |
| 152 _log.warning("Failed to open %s", url) | 152 _log.warning("Failed to open %s", url) |
| 153 webbrowser.open(url) | 153 webbrowser.open(url) |
| OLD | NEW |