Changeset 52135 in webkit
- Timestamp:
- Dec 14, 2009 10:00:55 PM (14 years ago)
- Location:
- trunk/WebKitTools
- Files:
-
- 2 added
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/WebKitTools/ChangeLog
r52134 r52135 1 2009-12-14 Eric Seidel <eric@webkit.org> 2 3 Reviewed by Adam Barth. 4 5 Move Credential handling out into a separate module 6 https://bugs.webkit.org/show_bug.cgi?id=32531 7 8 * Scripts/modules/bugzilla.py: 9 * Scripts/modules/credentials.py: Added. 10 * Scripts/modules/credentials_unittest.py: Added. 11 * Scripts/run-webkit-unittests: 12 1 13 2009-12-14 Adam Barth <abarth@webkit.org> 2 14 -
trunk/WebKitTools/Scripts/modules/bugzilla.py
r51959 r52135 30 30 # WebKit's Python module for interacting with Bugzilla 31 31 32 import getpass33 import platform34 32 import re 35 33 import subprocess … … 41 39 from modules.logging import error, log 42 40 from modules.committers import CommitterList 41 from modules.credentials import Credentials 43 42 44 43 # WebKit includes a built copy of BeautifulSoup in Scripts/modules … … 59 58 """ 60 59 exit(1) 61 62 def credentials_from_git():63 return [read_config("username"), read_config("password")]64 65 def credentials_from_keychain(username=None):66 if not is_mac_os_x():67 return [username, None]68 69 command = "/usr/bin/security %s -g -s %s" % ("find-internet-password", Bugzilla.bug_server_host)70 if username:71 command += " -a %s" % username72 73 log('Reading Keychain for %s account and password. Click "Allow" to continue...' % Bugzilla.bug_server_host)74 keychain_process = subprocess.Popen(command, stdout=subprocess.PIPE, stderr=subprocess.STDOUT, shell=True)75 value = keychain_process.communicate()[0]76 exit_code = keychain_process.wait()77 78 if exit_code:79 return [username, None]80 81 match = re.search('^\s*"acct"<blob>="(?P<username>.+)"', value, re.MULTILINE)82 if match:83 username = match.group('username')84 85 password = None86 match = re.search('^password: "(?P<password>.+)"', value, re.MULTILINE)87 if match:88 password = match.group('password')89 90 return [username, password]91 92 def is_mac_os_x():93 return platform.mac_ver()[0]94 60 95 61 def parse_bug_id(message): … … 102 68 return None 103 69 104 # FIXME: This should not depend on git for config storage105 def read_config(key):106 # Need a way to read from svn too107 config_process = subprocess.Popen("git config --get bugzilla.%s" % key, stdout=subprocess.PIPE, shell=True)108 value = config_process.communicate()[0]109 return_code = config_process.wait()110 111 if return_code:112 return None113 return value.rstrip('\n')114 115 def read_credentials():116 (username, password) = credentials_from_git()117 118 if not username or not password:119 (username, password) = credentials_from_keychain(username)120 121 if not username:122 username = raw_input("Bugzilla login: ")123 if not password:124 password = getpass.getpass("Bugzilla password for %s: " % username)125 126 return [username, password]127 70 128 71 def timestamp(): … … 134 77 135 78 136 class Bugzilla :79 class Bugzilla(object): 137 80 def __init__(self, dryrun=False, committers=CommitterList()): 138 81 self.dryrun = dryrun … … 371 314 return 372 315 373 (username, password) = read_credentials()316 (username, password) = Credentials(self.bug_server_host, git_prefix="bugzilla").read_credentials() 374 317 375 318 log("Logging in as %s..." % username) -
trunk/WebKitTools/Scripts/run-webkit-unittests
r51895 r52135 38 38 from modules.commands.queues_unittest import * 39 39 from modules.committers_unittest import * 40 from modules.credentials_unittest import * 40 41 from modules.cpp_style_unittest import * 41 42 from modules.diff_parser_unittest import *
Note: See TracChangeset
for help on using the changeset viewer.