mirror of
https://git.launchpad.net/ubuntu-dev-tools
synced 2025-03-13 08:01:09 +00:00
* lpapiwrapper.py:
- Move getUbuntuArchive() from LpApiWrapper to Distribution and rename it to getMainArchive()
This commit is contained in:
parent
046798d12b
commit
30915541e4
@ -84,15 +84,6 @@ class LpApiWrapper(object):
|
|||||||
'''
|
'''
|
||||||
return Distribution('ubuntu')
|
return Distribution('ubuntu')
|
||||||
|
|
||||||
@classmethod
|
|
||||||
def getUbuntuArchive(cls):
|
|
||||||
'''
|
|
||||||
Returns the LP representation for the Ubuntu main archive.
|
|
||||||
'''
|
|
||||||
if not cls._archive:
|
|
||||||
cls._archive = cls.getUbuntuDistribution().main_archive
|
|
||||||
return cls._archive
|
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def getUbuntuSeries(cls, name_or_version):
|
def getUbuntuSeries(cls, name_or_version):
|
||||||
'''
|
'''
|
||||||
@ -148,7 +139,7 @@ class LpApiWrapper(object):
|
|||||||
|
|
||||||
if (name, series, pocket) not in cls._src_pkg:
|
if (name, series, pocket) not in cls._src_pkg:
|
||||||
try:
|
try:
|
||||||
srcpkg = cls.getUbuntuArchive().getPublishedSources(
|
srcpkg = cls.getUbuntuDistribution().getMainArchive().getPublishedSources(
|
||||||
source_name = name, distro_series = series._lpobject, pocket = pocket,
|
source_name = name, distro_series = series._lpobject, pocket = pocket,
|
||||||
status = 'Published', exact_match = True)[0]
|
status = 'Published', exact_match = True)[0]
|
||||||
cls._src_pkg[(name, series, pocket)] = SourcePackage(srcpkg)
|
cls._src_pkg[(name, series, pocket)] = SourcePackage(srcpkg)
|
||||||
@ -192,7 +183,7 @@ class LpApiWrapper(object):
|
|||||||
|
|
||||||
if component not in cls._upload_comp and package not in cls._upload_pkg:
|
if component not in cls._upload_comp and package not in cls._upload_pkg:
|
||||||
me = cls.getMe()
|
me = cls.getMe()
|
||||||
archive = cls.getUbuntuArchive()
|
archive = cls.getUbuntuDistribution().getMainArchive()
|
||||||
for perm in archive.getPermissionsForPerson(person = me()):
|
for perm in archive.getPermissionsForPerson(person = me()):
|
||||||
if perm.permission != 'Archive Upload Rights':
|
if perm.permission != 'Archive Upload Rights':
|
||||||
continue
|
continue
|
||||||
@ -288,25 +279,33 @@ class BaseWrapper(object):
|
|||||||
|
|
||||||
|
|
||||||
class Distribution(BaseWrapper):
|
class Distribution(BaseWrapper):
|
||||||
'''
|
|
||||||
Wrapper class around a LP distribution object.
|
|
||||||
'''
|
|
||||||
resource_type = 'https://api.edge.launchpad.net/beta/#distribution'
|
|
||||||
|
|
||||||
def cache(self):
|
|
||||||
self._cache[self.name] = self
|
|
||||||
|
|
||||||
@classmethod
|
|
||||||
def fetch(cls, dist):
|
|
||||||
'''
|
|
||||||
Fetch the distribution object identified by 'url' from LP.
|
|
||||||
'''
|
'''
|
||||||
if not isinstance(dist, str):
|
Wrapper class around a LP distribution object.
|
||||||
raise TypeError("Don't know what do with '%r'" % dist)
|
'''
|
||||||
cached = cls._cache.get(dist)
|
resource_type = 'https://api.edge.launchpad.net/beta/#distribution'
|
||||||
if not cached:
|
|
||||||
cached = Distribution(Launchpad.distributions[dist])
|
def cache(self):
|
||||||
return cached
|
self._cache[self.name] = self
|
||||||
|
|
||||||
|
@classmethod
|
||||||
|
def fetch(cls, dist):
|
||||||
|
'''
|
||||||
|
Fetch the distribution object identified by 'url' from LP.
|
||||||
|
'''
|
||||||
|
if not isinstance(dist, str):
|
||||||
|
raise TypeError("Don't know what do with '%r'" % dist)
|
||||||
|
cached = cls._cache.get(dist)
|
||||||
|
if not cached:
|
||||||
|
cached = Distribution(Launchpad.distributions[dist])
|
||||||
|
return cached
|
||||||
|
|
||||||
|
def getMainArchive(self):
|
||||||
|
'''
|
||||||
|
Returns the LP representation for the Ubuntu main archive.
|
||||||
|
'''
|
||||||
|
if not '_archive' in self.__dict__:
|
||||||
|
self._archive = self.main_archive
|
||||||
|
return self._archive
|
||||||
|
|
||||||
|
|
||||||
class DistroSeries(BaseWrapper):
|
class DistroSeries(BaseWrapper):
|
||||||
|
Loading…
x
Reference in New Issue
Block a user