diff --git a/buildd b/buildd index 9d15c84..1b55f32 100755 --- a/buildd +++ b/buildd @@ -27,7 +27,7 @@ import sys from optparse import OptionGroup from optparse import OptionParser from ubuntutools.lp.udtexceptions import SeriesNotFoundException, PackageNotFoundException -from ubuntutools.lp.lpapicache import LpApiWrapper, PersonTeam +from ubuntutools.lp.lpapicache import Distribution, PersonTeam # Usage. usage = "%prog \n\n" @@ -124,7 +124,7 @@ if not options.batch: sys.exit(1) # Get the ubuntu archive - ubuntu_archive = LpApiWrapper.getUbuntuDistribution().getArchive() + ubuntu_archive = Distribution('ubuntu').getArchive() # Get list of published sources for package in question. try: sources = ubuntu_archive.getSourcePackage(package, release, pocket) @@ -210,7 +210,7 @@ if release and '-' in release: print 'Unknown pocket: %s' % pocket sys.exit(1) -ubuntu_archive = LpApiWrapper.getUbuntuDistribution().getArchive() +ubuntu_archive = Distribution('ubuntu').getArchive() me = PersonTeam.getMe() # Check permisions (part 1): Rescoring can only be done by buildd admins diff --git a/pull-lp-source b/pull-lp-source index 6f3cb6a..6e4556c 100755 --- a/pull-lp-source +++ b/pull-lp-source @@ -33,7 +33,7 @@ import urllib2 from optparse import OptionParser # ubuntu-dev-tools modules. -from ubuntutools.lp.lpapicache import LpApiWrapper +from ubuntutools.lp.lpapicache import LpApiWrapper, Distribution from ubuntutools.lp.udtexceptions import SeriesNotFoundException, PackageNotFoundException if not os.path.exists("/usr/bin/dget"): @@ -76,7 +76,7 @@ if __name__ == '__main__': if len(args) == 2: # Custom distribution specified. release = str(args[1]).lower() else: - release = os.getenv('DIST') or LpApiWrapper.getUbuntuDistribution().getDevelopmentSeries().name + release = os.getenv('DIST') or Distribution('ubuntu').getDevelopmentSeries().name # Arguments are correct, proceed. # Check that the Ubuntu release and package specified exists. diff --git a/requestsync b/requestsync index 2df9471..1ddd5e6 100755 --- a/requestsync +++ b/requestsync @@ -38,7 +38,7 @@ from time import sleep # ubuntu-dev-tools modules. import ubuntutools.lp.libsupport as lp_libsupport import ubuntutools.lp.udtexceptions as udtexceptions -from ubuntutools.lp.lpapicache import Launchpad, LpApiWrapper, PersonTeam +from ubuntutools.lp.lpapicache import Launchpad, LpApiWrapper, Distribution, PersonTeam # https_proxy fix import ubuntutools.common import ubuntutools.packages @@ -95,7 +95,7 @@ def checkExistingReports(package): return False # Fetch the package's bug list from Launchpad. - pkg = LpApiWrapper.getUbuntuDistribution().getSourcePackage(name=package) + pkg = Distribution('ubuntu').getSourcePackage(name=package) pkgBugList = pkg.searchTasks() # Search bug list for other sync requests. @@ -474,7 +474,7 @@ if __name__ == '__main__': sys.exit(1) if len(args) not in (2, 3): # no release specified, assume development release - release = LpApiWrapper.getUbuntuDistribution().getDevelopmentSeries().name + release = Distribution('ubuntu').getDevelopmentSeries().name print >> sys.stderr, ("Source package / target release missing - assuming %s " % release) else: diff --git a/ubuntutools/lp/lpapicache.py b/ubuntutools/lp/lpapicache.py index 16327cb..3eeb9ef 100644 --- a/ubuntutools/lp/lpapicache.py +++ b/ubuntutools/lp/lpapicache.py @@ -58,13 +58,6 @@ class LpApiWrapper(object): ubuntu-dev-tools. ''' - @classmethod - def getUbuntuDistribution(cls): - ''' - Returns a Distibution object for Ubuntu. - ''' - return Distribution('ubuntu') - @classmethod def getUbuntuSourcePackage(cls, name, series, pocket = 'Release'): ''' @@ -73,7 +66,7 @@ class LpApiWrapper(object): Returns a wrapped LP representation of the source package. If the package does not exist: raise PackageNotFoundException ''' - return cls.getUbuntuDistribution().getArchive().getSourcePackage(name, series, pocket) + return Distribution('ubuntu').getArchive().getSourcePackage(name, series, pocket) @classmethod def canUploadPackage(cls, srcpkg, series = None): @@ -87,14 +80,14 @@ class LpApiWrapper(object): assume 'universe' for component. ''' component = 'universe' - archive = cls.getUbuntuDistribution().getArchive() + archive = Distribution('ubuntu').getArchive() if isinstance(srcpkg, SourcePackage): package = srcpkg.getPackageName() component = srcpkg.getComponent() else: if not series: - series = cls.getUbuntuDistribution().getDevelopmentSeries() + series = Distribution('ubuntu').getDevelopmentSeries() try: srcpkg = archive.getSourcePackage(srcpkg, series) package = srcpkg.getPackageName() @@ -113,7 +106,7 @@ class LpApiWrapper(object): if isinstance(package, SourcePackage): package = package.getPackageName() - archive = cls.getUbuntuDistribution().getArchive() + archive = Distribution('ubuntu').getArchive() return PersonTeam.getMe().canUploadPackage(archive, package, None)