Merge pull request #1628 from coolo/fix_1626

Lazy evaluation the ring projects
This commit is contained in:
Stephan Kulow 2018-08-01 16:58:33 +02:00 committed by GitHub
commit cc79ce04f0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

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, [])