Merge ~smoser/git-ubuntu:faster2 into git-ubuntu:master

Proposed by Scott Moser
Status: Merged
Merged at revision: 8c467e4581c088acc60932dc33b3976e983fa81e
Proposed branch: ~smoser/git-ubuntu:faster2
Merge into: git-ubuntu:master
Diff against target: 47 lines (+14/-1)
1 file modified
usd/source_information.py (+14/-1)
Reviewer Review Type Date Requested Status
Nish Aravamudan Approve
Review via email: mp+310893@code.launchpad.net
To post a comment you must log in.
Revision history for this message
Nish Aravamudan (nacc) :
review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1diff --git a/usd/source_information.py b/usd/source_information.py
2index cd8f547..7d9be3b 100644
3--- a/usd/source_information.py
4+++ b/usd/source_information.py
5@@ -2,6 +2,8 @@ import logging
6 import re
7 import sys
8 import time
9+_LP_LOGIN = None
10+
11 try:
12 pkg = 'python3-launchpadlib'
13 from launchpadlib.launchpad import Launchpad
14@@ -12,6 +14,17 @@ except ImportError:
15 sys.exit(1)
16
17
18+def launchpad_login():
19+ """Cache a single launchpad login here."""
20+ global _LP_LOGIN
21+ if _LP_LOGIN:
22+ return _LP_LOGIN
23+
24+ _LP_LOGIN = Launchpad.login_anonymously('usd-importer', 'production',
25+ version='devel')
26+ return _LP_LOGIN
27+
28+
29 class USDSourcePackageInformation:
30 def __init__(self, spphr, retries=0, retry_backoffs=[],
31 workdir=None, dsc=None, files=list()):
32@@ -139,7 +152,6 @@ class NoPublicationHistoryException(Exception):
33
34 # An abstraction of an information source about source packages
35 class USDSourceInformation(object):
36- launchpad = Launchpad.login_anonymously('usd-importer', 'production', version='devel')
37 _series_list = None
38
39 def __init__(self, dist_name, pkgname,
40@@ -147,6 +159,7 @@ class USDSourceInformation(object):
41 retries,
42 retry_backoffs
43 ):
44+ self.launchpad = launchpad_login()
45 self.dist = self.launchpad.distributions[dist_name]
46 self.pkgname = pkgname
47 self.parse_pullfile(pull_overrides_filename)

Subscribers

People subscribed via source and target branches