|
|
|
@ -5,6 +5,7 @@ import math
|
|
|
|
|
import socket
|
|
|
|
|
import smtplib
|
|
|
|
|
|
|
|
|
|
from urllib.error import HTTPError
|
|
|
|
|
from urllib.parse import unquote
|
|
|
|
|
from collections import defaultdict
|
|
|
|
|
|
|
|
|
@ -117,6 +118,7 @@ class EmailPolicy(BasePolicy, Rest):
|
|
|
|
|
if person in self.addresses:
|
|
|
|
|
return self.addresses[person]
|
|
|
|
|
addresses = []
|
|
|
|
|
try:
|
|
|
|
|
gpg = self.query_lp_rest_api(person + '/gpg_keys', {})
|
|
|
|
|
for key in gpg['entries']:
|
|
|
|
|
details = self.query_rest_api('http://keyserver.ubuntu.com/pks/lookup', {
|
|
|
|
@ -140,10 +142,16 @@ class EmailPolicy(BasePolicy, Rest):
|
|
|
|
|
addresses.append(match.group(1))
|
|
|
|
|
address = self.addresses[person] = address_chooser(addresses)
|
|
|
|
|
return address
|
|
|
|
|
except HTTPError as e:
|
|
|
|
|
if e.code != 410: # suspended user
|
|
|
|
|
raise
|
|
|
|
|
self.log('Ignoring person %s as suspended in Launchpad' % person)
|
|
|
|
|
return None
|
|
|
|
|
|
|
|
|
|
def scrape_gpg_emails(self, people):
|
|
|
|
|
"""Find email addresses from GPG keys."""
|
|
|
|
|
return [self._scrape_gpg_emails(person) for person in (people or [])]
|
|
|
|
|
emails = [self._scrape_gpg_emails(person) for person in (people or [])]
|
|
|
|
|
return [email for email in emails if email is not None]
|
|
|
|
|
|
|
|
|
|
def lp_get_emails(self, pkg, version):
|
|
|
|
|
"""Ask LP who uploaded this package."""
|
|
|
|
|