mirror of
https://git.launchpad.net/ubuntu-dev-tools
synced 2025-03-16 01:21:07 +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
@ -30,6 +30,7 @@ from ubuntutools.lp.udtexceptions import (SeriesNotFoundException,
|
|||||||
PackageNotFoundException,
|
PackageNotFoundException,
|
||||||
PocketDoesNotExistError,)
|
PocketDoesNotExistError,)
|
||||||
from ubuntutools.lp.lpapicache import Distribution, PersonTeam
|
from ubuntutools.lp.lpapicache import Distribution, PersonTeam
|
||||||
|
from launchpadlib.credentials import TokenAuthorizationException
|
||||||
from ubuntutools.misc import split_release_pocket
|
from ubuntutools.misc import split_release_pocket
|
||||||
|
|
||||||
from ubuntutools import getLogger
|
from ubuntutools import getLogger
|
||||||
@ -135,12 +136,14 @@ def main():
|
|||||||
Logger.error(error)
|
Logger.error(error)
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
|
|
||||||
# Get the ubuntu archive
|
|
||||||
try:
|
try:
|
||||||
ubuntu_archive = Distribution('ubuntu').getArchive()
|
|
||||||
# Will fail here if we have no credentials, bail out
|
# Will fail here if we have no credentials, bail out
|
||||||
except IOError:
|
Launchpad.login()
|
||||||
|
except TokenAuthorizationException:
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
|
|
||||||
|
# Get the ubuntu archive
|
||||||
|
ubuntu_archive = Distribution('ubuntu').getArchive()
|
||||||
# Get list of published sources for package in question.
|
# Get list of published sources for package in question.
|
||||||
try:
|
try:
|
||||||
sources = ubuntu_archive.getSourcePackage(package, release, pocket)
|
sources = ubuntu_archive.getSourcePackage(package, release, pocket)
|
||||||
|
@ -74,12 +74,14 @@ class _Launchpad(object):
|
|||||||
def login(self, service=service, api_version=api_version):
|
def login(self, service=service, api_version=api_version):
|
||||||
'''Enforce a non-anonymous login.'''
|
'''Enforce a non-anonymous login.'''
|
||||||
if not self.logged_in:
|
if not self.logged_in:
|
||||||
try:
|
|
||||||
self.__lp = LP.login_with('ubuntu-dev-tools', service,
|
self.__lp = LP.login_with('ubuntu-dev-tools', service,
|
||||||
version=api_version)
|
version=api_version)
|
||||||
except IOError as error:
|
# Unfortunately launchpadlib may 'login' using cached
|
||||||
Logger.error(str(error))
|
# credentials, without actually verifying if the credentials
|
||||||
raise
|
# 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:
|
else:
|
||||||
raise AlreadyLoggedInError('Already logged in to Launchpad.')
|
raise AlreadyLoggedInError('Already logged in to Launchpad.')
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user