Lazy evaluation the ring projects

So we can use the StagingAPI also for projects below the target
project

Fixes #1626
This commit is contained in:
Stephan Kulow 2018-07-31 15:24:50 +02:00
parent 27f0056e8d
commit b40036fb71

View File

@ -74,6 +74,7 @@ class StagingAPI(object):
# Store some prefix / data used in the code.
self.user = conf.get_apiurl_usr(apiurl)
self._rings = None
self._ring_packages = None
self._ring_packages_for_links = None
self._packages_staged = None
@ -81,15 +82,6 @@ class StagingAPI(object):
self._supersede = False
self._package_disabled = {}
# If the project support rings, inititialize some variables.
if self.crings:
self.rings = (
'{}:0-Bootstrap'.format(self.crings),
'{}:1-MinimalX'.format(self.crings)
)
else:
self.rings = []
Cache.init()
def __getattr__(self, attr):
@ -110,6 +102,21 @@ class StagingAPI(object):
# Raise AttributeError like normal.
return self.__getattribute__(attr)
@property
def rings(self):
if self._rings is None:
# If the project support rings, inititialize some variables.
if self.crings:
self._rings = (
'{}:0-Bootstrap'.format(self.crings),
'{}:1-MinimalX'.format(self.crings)
)
else:
self._rings = []
return self._rings
@property
def ring_packages(self):
if self._ring_packages is None:
@ -1838,4 +1845,3 @@ class StagingAPI(object):
def expanded_repos(self, repo):
return self.expand_project_repo(self.project, repo, [])