mirror of
https://git.launchpad.net/ubuntu-dev-tools
synced 2025-03-13 08:01:09 +00:00
* ubuntutools/lp/lpapiwrapper.py:
Make getUbuntuSourcePackage a classmethod * buildd: Remove unneeded variables
This commit is contained in:
parent
f03f0ec72a
commit
81c1cf50df
15
buildd
15
buildd
@ -25,7 +25,7 @@
|
|||||||
import sys
|
import sys
|
||||||
from optparse import OptionGroup
|
from optparse import OptionGroup
|
||||||
from optparse import OptionParser
|
from optparse import OptionParser
|
||||||
import ubuntutools.lp.udtexceptions
|
from ubuntutools.lp.udtexceptions import SeriesNotFoundException, PackageNotFoundException
|
||||||
from ubuntutools.lp.lpapiwrapper import LpApiWrapper
|
from ubuntutools.lp.lpapiwrapper import LpApiWrapper
|
||||||
import ubuntutools.lp.functions as lp_functions
|
import ubuntutools.lp.functions as lp_functions
|
||||||
|
|
||||||
@ -106,19 +106,14 @@ if pocket not in ('Release', 'Security', 'Updates', 'Proposed', 'Backports'):
|
|||||||
print 'Unknown pocket: %s' % pocket
|
print 'Unknown pocket: %s' % pocket
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
|
|
||||||
# Initialize ubuntu distribution collection.
|
# Get an instance of the LP API wrapper
|
||||||
lpapiwrapper = LpApiWrapper()
|
lpapiwrapper = LpApiWrapper()
|
||||||
ubuntuDist = lpapiwrapper.getUbuntuDistribution()
|
# Get list of published sources for package in question.
|
||||||
# Get main Ubuntu archive.
|
|
||||||
archive = lpapiwrapper.getUbuntuArchive()
|
|
||||||
# Check the release exists.
|
|
||||||
try:
|
try:
|
||||||
release_series = lpapiwrapper.getUbuntuSeries(release)
|
sources = lpapiwrapper.getUbuntuSourcePackage(package, release, pocket)
|
||||||
except ubuntutools.lp.udtexceptions.SeriesNotFoundException, e:
|
except (SeriesNotFoundException, PackageNotFoundException), e:
|
||||||
print e
|
print e
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
# Get list of published sources for package in question.
|
|
||||||
sources = lpapiwrapper.getUbuntuSourcePackage(package, release, pocket)
|
|
||||||
# Get list of builds for that package.
|
# Get list of builds for that package.
|
||||||
builds = sources.getBuilds()
|
builds = sources.getBuilds()
|
||||||
|
|
||||||
|
@ -52,11 +52,12 @@ class LpApiWrapper(object):
|
|||||||
'''
|
'''
|
||||||
_ubuntu = None
|
_ubuntu = None
|
||||||
_archive = None
|
_archive = None
|
||||||
_series = dict()
|
|
||||||
_devel_series = None
|
_devel_series = None
|
||||||
|
_series = dict()
|
||||||
|
_src_pkg = dict()
|
||||||
|
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
self._src_pkg = dict()
|
pass
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def getUbuntuDistribution(cls):
|
def getUbuntuDistribution(cls):
|
||||||
@ -91,7 +92,7 @@ class LpApiWrapper(object):
|
|||||||
cls._series[series.name] = series
|
cls._series[series.name] = series
|
||||||
cls._series[series.version] = series
|
cls._series[series.version] = series
|
||||||
except HTTPError:
|
except HTTPError:
|
||||||
raise SeriesNotFoundException("Error: Unknown Ubuntu release: '%s'." % name)
|
raise SeriesNotFoundException("Error: Unknown Ubuntu release: '%s'." % name_or_version)
|
||||||
|
|
||||||
return cls._series[name_or_version]
|
return cls._series[name_or_version]
|
||||||
|
|
||||||
@ -112,7 +113,8 @@ class LpApiWrapper(object):
|
|||||||
|
|
||||||
return cls._devel_series
|
return cls._devel_series
|
||||||
|
|
||||||
def getUbuntuSourcePackage(self, name, series, pocket = 'Release'):
|
@classmethod
|
||||||
|
def getUbuntuSourcePackage(cls, name, series, pocket = 'Release'):
|
||||||
'''
|
'''
|
||||||
Finds an Ubuntu source package on LP.
|
Finds an Ubuntu source package on LP.
|
||||||
|
|
||||||
@ -126,14 +128,14 @@ class LpApiWrapper(object):
|
|||||||
|
|
||||||
# Check if we have already a LP representation of an Ubuntu series or not
|
# Check if we have already a LP representation of an Ubuntu series or not
|
||||||
if not isinstance(series, Entry):
|
if not isinstance(series, Entry):
|
||||||
series = self.getUbuntuSeries(str(series))
|
series = cls.getUbuntuSeries(str(series))
|
||||||
|
|
||||||
if (name, series, pocket) not in self._src_pkg:
|
if (name, series, pocket) not in cls._src_pkg:
|
||||||
try:
|
try:
|
||||||
srcpkg = self.getUbuntuArchive().getPublishedSources(
|
srcpkg = cls.getUbuntuArchive().getPublishedSources(
|
||||||
source_name = name, distro_series = series, pocket = pocket,
|
source_name = name, distro_series = series, pocket = pocket,
|
||||||
status = 'Published', exact_match = True)[0]
|
status = 'Published', exact_match = True)[0]
|
||||||
self._src_pkg[(name, series, pocket)] = srcpkg
|
cls._src_pkg[(name, series, pocket)] = srcpkg
|
||||||
except IndexError:
|
except IndexError:
|
||||||
if pocket == 'Release':
|
if pocket == 'Release':
|
||||||
msg = "The package '%s' does not exist in the Ubuntu main archive in '%s'" % \
|
msg = "The package '%s' does not exist in the Ubuntu main archive in '%s'" % \
|
||||||
@ -144,4 +146,4 @@ class LpApiWrapper(object):
|
|||||||
|
|
||||||
raise PackageNotFoundException(msg)
|
raise PackageNotFoundException(msg)
|
||||||
|
|
||||||
return self._src_pkg[(name, series, pocket)]
|
return cls._src_pkg[(name, series, pocket)]
|
||||||
|
Loading…
x
Reference in New Issue
Block a user