ubuntutools/lp/__init__.py: Define the default LP service to use (default: edge)

ubuntutools/lp/__init__.py: Don't hardcode the LP service root but look it up instead
debian/control: Depend on python-launchpadlib >= 1.5.4 because of this
This commit is contained in:
Michael Bienia 2010-02-06 01:53:29 +01:00
parent 95487419e7
commit a33a5c106b
3 changed files with 17 additions and 11 deletions

2
debian/control vendored
View File

@ -13,7 +13,7 @@ Standards-Version: 3.8.3
Package: ubuntu-dev-tools
Architecture: all
Depends: ${python:Depends}, ${misc:Depends}, binutils, devscripts, sudo,
python-debian, python-launchpadlib, dctrl-tools, lsb-release, diffstat,
python-debian, python-launchpadlib (>= 1.5.4), dctrl-tools, lsb-release, diffstat,
dpkg-dev, python-apt (>= 0.7.9), python-lazr.restfulclient
Recommends: bzr, pbuilder | cowdancer | sbuild, reportbug (>= 3.39ubuntu1),
ca-certificates, debootstrap, genisoimage, perl-modules, libwww-perl,

View File

@ -1,3 +1,5 @@
##
## ubuntu-dev-tools Launchpad Python modules.
##
service = 'edge'

View File

@ -3,7 +3,7 @@
# lpapicache.py - wrapper classes around the LP API implementing caching
# for usage in the ubuntu-dev-tools package
#
# Copyright © 2009 Michael Bienia <geser@ubuntu.com>
# Copyright © 2009-2010 Michael Bienia <geser@ubuntu.com>
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
@ -25,10 +25,14 @@
#httplib2.debuglevel = 1
import sys
import libsupport
from launchpadlib.errors import HTTPError
from launchpadlib.uris import lookup_service_root
from lazr.restfulclient.resource import Entry
from udtexceptions import *
import ubuntutools.lp.libsupport as libsupport
from ubuntutools.lp import service
from ubuntutools.lp.udtexceptions import *
class Launchpad(object):
''' Singleton for LP API access. '''
@ -125,7 +129,7 @@ class Distribution(BaseWrapper):
'''
Wrapper class around a LP distribution object.
'''
resource_type = 'https://api.edge.launchpad.net/beta/#distribution'
resource_type = lookup_service_root(service) + '#distribution'
def __init__(self, *args):
# Don't share _series and _archives between different Distributions
@ -207,14 +211,14 @@ class DistroSeries(BaseWrapper):
'''
Wrapper class around a LP distro series object.
'''
resource_type = 'https://api.edge.launchpad.net/beta/#distro_series'
resource_type = lookup_service_root(service) + '#distro_series'
class Archive(BaseWrapper):
'''
Wrapper class around a LP archive object.
'''
resource_type = 'https://api.edge.launchpad.net/beta/#archive'
resource_type = lookup_service_root(service) + '#archive'
def __init__(self, *args):
# Don't share _srcpkgs between different Archives
@ -275,7 +279,7 @@ class SourcePackagePublishingHistory(BaseWrapper):
'''
Wrapper class around a LP source package object.
'''
resource_type = 'https://api.edge.launchpad.net/beta/#source_package_publishing_history'
resource_type = lookup_service_root(service) + '#source_package_publishing_history'
def __init__(self, *args):
# Don't share _builds between different SourcePackagePublishingHistory objects
@ -356,7 +360,7 @@ class PersonTeam(BaseWrapper):
'''
Wrapper class around a LP person or team object.
'''
resource_type = ('https://api.edge.launchpad.net/beta/#person', 'https://api.edge.launchpad.net/beta/#team')
resource_type = (lookup_service_root(service) + '#person', lookup_service_root(service) + '#team')
_me = None # the PersonTeam object of the currently authenticated LP user
@ -459,7 +463,7 @@ class Build(BaseWrapper):
'''
Wrapper class around a build object.
'''
resource_type = 'https://api.edge.launchpad.net/beta/#build'
resource_type = lookup_service_root(service) + '#build'
def __str__(self):
return u'%s: %s' % (self.arch_tag, self.buildstate)
@ -481,4 +485,4 @@ class DistributionSourcePackage(BaseWrapper):
'''
Caching class for distribution_source_package objects.
'''
resource_type = 'https://api.edge.launchpad.net/beta/#distribution_source_package'
resource_type = lookup_service_root(service) + '#distribution_source_package'