mirror of
https://git.launchpad.net/ubuntu-dev-tools
synced 2025-03-12 23:51:08 +00:00
Merge branch 'lp1984113' of git+ssh://git.launchpad.net/~ddstreet/ubuntu-dev-tools
MR: https://code.launchpad.net/~ddstreet/ubuntu-dev-tools/+git/ubuntu-dev-tools/+merge/428101 Signed-off-by: Mattia Rizzolo <mattia@debian.org>
This commit is contained in:
commit
05af489f64
11
ubuntu-build
11
ubuntu-build
@ -30,6 +30,7 @@ from ubuntutools.lp.udtexceptions import (SeriesNotFoundException,
|
||||
PackageNotFoundException,
|
||||
PocketDoesNotExistError,)
|
||||
from ubuntutools.lp.lpapicache import Distribution, PersonTeam
|
||||
from launchpadlib.credentials import TokenAuthorizationException
|
||||
from ubuntutools.misc import split_release_pocket
|
||||
|
||||
from ubuntutools import getLogger
|
||||
@ -135,12 +136,14 @@ def main():
|
||||
Logger.error(error)
|
||||
sys.exit(1)
|
||||
|
||||
# Get the ubuntu archive
|
||||
try:
|
||||
ubuntu_archive = Distribution('ubuntu').getArchive()
|
||||
# Will fail here if we have no credentials, bail out
|
||||
except IOError:
|
||||
# Will fail here if we have no credentials, bail out
|
||||
Launchpad.login()
|
||||
except TokenAuthorizationException:
|
||||
sys.exit(1)
|
||||
|
||||
# Get the ubuntu archive
|
||||
ubuntu_archive = Distribution('ubuntu').getArchive()
|
||||
# Get list of published sources for package in question.
|
||||
try:
|
||||
sources = ubuntu_archive.getSourcePackage(package, release, pocket)
|
||||
|
@ -74,12 +74,14 @@ class _Launchpad(object):
|
||||
def login(self, service=service, api_version=api_version):
|
||||
'''Enforce a non-anonymous login.'''
|
||||
if not self.logged_in:
|
||||
try:
|
||||
self.__lp = LP.login_with('ubuntu-dev-tools', service,
|
||||
version=api_version)
|
||||
except IOError as error:
|
||||
Logger.error(str(error))
|
||||
raise
|
||||
self.__lp = LP.login_with('ubuntu-dev-tools', service,
|
||||
version=api_version)
|
||||
# Unfortunately launchpadlib may 'login' using cached
|
||||
# credentials, without actually verifying if the credentials
|
||||
# are valid; which can lead to this 'login' not actually
|
||||
# logging in.
|
||||
# So, this forces actual LP access here, to force actual login.
|
||||
self.__lp.me
|
||||
else:
|
||||
raise AlreadyLoggedInError('Already logged in to Launchpad.')
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user