Merge from trunk

This commit is contained in:
Stefano Rivera 2010-12-21 21:50:59 +02:00
commit 13cbe49a19
2 changed files with 18 additions and 13 deletions

7
debian/changelog vendored
View File

@ -1,5 +1,6 @@
ubuntu-dev-tools (0.109) UNRELEASED; urgency=low ubuntu-dev-tools (0.109) UNRELEASED; urgency=low
[ Stefano Rivera ]
* Convert debian/copyright to DEP5, make sure all scripts are listed * Convert debian/copyright to DEP5, make sure all scripts are listed
(LP: #692003) (LP: #692003)
* Drop preinst (pbuilder-dist bash_completion handling), it is not required * Drop preinst (pbuilder-dist bash_completion handling), it is not required
@ -17,7 +18,11 @@ ubuntu-dev-tools (0.109) UNRELEASED; urgency=low
* ubuntutools/common.py: Remove https_proxy unsetting code, working around * ubuntutools/common.py: Remove https_proxy unsetting code, working around
LP: #94130. LP: #94130.
-- Stefano Rivera <stefanor@ubuntu.com> Mon, 20 Dec 2010 20:54:14 +0200 [ Michael Bienia ]
* ubuntutools/lp/lpapicache.py: Allow easier selection of 'staging' as LP
instance to use (lp: #693060).
-- Michael Bienia <geser@ubuntu.com> Tue, 21 Dec 2010 19:14:57 +0100
ubuntu-dev-tools (0.108) experimental; urgency=low ubuntu-dev-tools (0.108) experimental; urgency=low

View File

@ -28,7 +28,6 @@ import sys
import launchpadlib.launchpad as launchpad import launchpadlib.launchpad as launchpad
from launchpadlib.errors import HTTPError from launchpadlib.errors import HTTPError
from launchpadlib.uris import lookup_service_root
from lazr.restfulclient.resource import Entry from lazr.restfulclient.resource import Entry
import ubuntutools.lp.libsupport as libsupport import ubuntutools.lp.libsupport as libsupport
@ -64,7 +63,7 @@ class Launchpad(object):
else: else:
raise AlreadyLoggedInError('Already logged in to Launchpad.') raise AlreadyLoggedInError('Already logged in to Launchpad.')
def login_anonymously(self): def login_anonymously(self, service=service, api_version=api_version):
'''Enforce an anonymous login.''' '''Enforce an anonymous login.'''
if '_Launchpad__lp' not in self.__dict__: if '_Launchpad__lp' not in self.__dict__:
self.__lp = launchpad.Launchpad.login_anonymously('ubuntu-dev-tools', self.__lp = launchpad.Launchpad.login_anonymously('ubuntu-dev-tools',
@ -101,7 +100,7 @@ class BaseWrapper(object):
resource_type = None # it's a base class after all resource_type = None # it's a base class after all
def __new__(cls, data): def __new__(cls, data):
if isinstance(data, basestring) and data.startswith('%s%s/' % (lookup_service_root(service), api_version)): if isinstance(data, basestring) and data.startswith(str(Launchpad._root_uri)):
# looks like a LP API URL # looks like a LP API URL
# check if it's already cached # check if it's already cached
cached = cls._cache.get(data) cached = cls._cache.get(data)
@ -116,7 +115,8 @@ class BaseWrapper(object):
pass pass
if isinstance(data, Entry): if isinstance(data, Entry):
if data.resource_type_link in cls.resource_type: (service_root, resource_type) = data.resource_type_link.split('#')
if service_root == str(Launchpad._root_uri) and resource_type in cls.resource_type:
# check if it's already cached # check if it's already cached
cached = cls._cache.get(data.self_link) cached = cls._cache.get(data.self_link)
if not cached: if not cached:
@ -157,7 +157,7 @@ class Distribution(BaseWrapper):
''' '''
Wrapper class around a LP distribution object. Wrapper class around a LP distribution object.
''' '''
resource_type = lookup_service_root(service) + api_version + '/#distribution' resource_type = 'distribution'
def __init__(self, *args): def __init__(self, *args):
# Don't share _series and _archives between different Distributions # Don't share _series and _archives between different Distributions
@ -239,14 +239,14 @@ class DistroSeries(BaseWrapper):
''' '''
Wrapper class around a LP distro series object. Wrapper class around a LP distro series object.
''' '''
resource_type = lookup_service_root(service) + api_version + '/#distro_series' resource_type = 'distro_series'
class Archive(BaseWrapper): class Archive(BaseWrapper):
''' '''
Wrapper class around a LP archive object. Wrapper class around a LP archive object.
''' '''
resource_type = lookup_service_root(service) + api_version + '/#archive' resource_type = 'archive'
def __init__(self, *args): def __init__(self, *args):
# Don't share _srcpkgs between different Archives # Don't share _srcpkgs between different Archives
@ -307,7 +307,7 @@ class SourcePackagePublishingHistory(BaseWrapper):
''' '''
Wrapper class around a LP source package object. Wrapper class around a LP source package object.
''' '''
resource_type = lookup_service_root(service) + api_version + '/#source_package_publishing_history' resource_type = 'source_package_publishing_history'
def __init__(self, *args): def __init__(self, *args):
# Don't share _builds between different SourcePackagePublishingHistory objects # Don't share _builds between different SourcePackagePublishingHistory objects
@ -408,8 +408,8 @@ class PersonTeam(BaseWrapper):
__metaclass__ = MetaPersonTeam __metaclass__ = MetaPersonTeam
resource_type = ( resource_type = (
lookup_service_root(service) + api_version + '/#person', 'person',
lookup_service_root(service) + api_version + '/#team', 'team',
) )
def __init__(self, *args): def __init__(self, *args):
@ -491,7 +491,7 @@ class Build(BaseWrapper):
''' '''
Wrapper class around a build object. Wrapper class around a build object.
''' '''
resource_type = lookup_service_root(service) + api_version + '/#build' resource_type = 'build'
def __str__(self): def __str__(self):
return u'%s: %s' % (self.arch_tag, self.buildstate) return u'%s: %s' % (self.arch_tag, self.buildstate)
@ -513,4 +513,4 @@ class DistributionSourcePackage(BaseWrapper):
''' '''
Caching class for distribution_source_package objects. Caching class for distribution_source_package objects.
''' '''
resource_type = lookup_service_root(service) + api_version + '/#distribution_source_package' resource_type = 'distribution_source_package'