use local type and model data for releases.openstack.org
Update the sphinx extension to pull the release model and project type from the local deliverable file instead of the governance repository. Change-Id: Iddc1accc52fdcc6f0fad9993ec073de325f3a4b0 Signed-off-by: Doug Hellmann <doug@doughellmann.com>
This commit is contained in:
parent
1392fa23d6
commit
81b1bbaf62
@ -23,7 +23,6 @@ from docutils.statemachine import ViewList
|
|||||||
from sphinx.util.nodes import nested_parse_with_titles
|
from sphinx.util.nodes import nested_parse_with_titles
|
||||||
|
|
||||||
from openstack_releases import deliverable
|
from openstack_releases import deliverable
|
||||||
from openstack_releases import governance
|
|
||||||
|
|
||||||
|
|
||||||
def _list_table(add, headers, data, title='', columns=None):
|
def _list_table(add, headers, data, title='', columns=None):
|
||||||
@ -56,33 +55,20 @@ def _list_table(add, headers, data, title='', columns=None):
|
|||||||
add('')
|
add('')
|
||||||
|
|
||||||
|
|
||||||
def _get_deliverable_type(name, data):
|
def _get_category(data):
|
||||||
if (name.startswith('python-') and name.endswith('client')):
|
model = data.get('release-model')
|
||||||
return 'type:library'
|
if model == 'cycle-trailing':
|
||||||
for tag in data.get('tags', []):
|
return 'cycle-trailing'
|
||||||
if tag == 'release:cycle-trailing':
|
return data.get('type')
|
||||||
return tag
|
|
||||||
if tag.startswith('type:'):
|
|
||||||
return tag
|
|
||||||
return _DEFAULT_TYPE
|
|
||||||
|
|
||||||
|
|
||||||
_DEFAULT_TYPE = 'type:other'
|
|
||||||
_deliverables = None
|
_deliverables = None
|
||||||
_all_teams = {}
|
|
||||||
_all_deliverable_types = {}
|
|
||||||
|
|
||||||
|
|
||||||
def _initialize_team_data(app):
|
def _initialize_deliverable_data(app):
|
||||||
global _deliverables
|
global _deliverables
|
||||||
global _all_teams
|
|
||||||
|
|
||||||
_deliverables = deliverable.Deliverables('deliverables')
|
_deliverables = deliverable.Deliverables('deliverables')
|
||||||
team_data = governance.get_team_data()
|
|
||||||
for tn, td in team_data.items():
|
|
||||||
_all_teams[tn] = td
|
|
||||||
for dn, dd in td['deliverables'].items():
|
|
||||||
_all_deliverable_types[dn] = _get_deliverable_type(dn, dd)
|
|
||||||
|
|
||||||
|
|
||||||
class DeliverableDirectiveBase(rst.Directive):
|
class DeliverableDirectiveBase(rst.Directive):
|
||||||
@ -92,12 +78,12 @@ class DeliverableDirectiveBase(rst.Directive):
|
|||||||
'team': directives.unchanged,
|
'team': directives.unchanged,
|
||||||
}
|
}
|
||||||
|
|
||||||
_TYPE_ORDER = [
|
_CATEGORY_ORDER = [
|
||||||
'type:service',
|
'service',
|
||||||
'type:library',
|
'library',
|
||||||
'type:horizon-plugin',
|
'horizon-plugin',
|
||||||
'type:other',
|
'other',
|
||||||
'release:cycle-trailing',
|
'cycle-trailing',
|
||||||
]
|
]
|
||||||
|
|
||||||
def run(self):
|
def run(self):
|
||||||
@ -137,12 +123,11 @@ class DeliverableDirectiveBase(rst.Directive):
|
|||||||
)
|
)
|
||||||
else:
|
else:
|
||||||
# Only the deliverables for the given series are
|
# Only the deliverables for the given series are
|
||||||
# shown. They are organized by type. The type is only
|
# shown. They are categorized by type, which we need to
|
||||||
# available from the governance data, so we have to add it
|
# extract from the data.
|
||||||
# to the raw data before sorting and grouping.
|
|
||||||
raw_deliverables = (
|
raw_deliverables = (
|
||||||
(_all_deliverable_types.get(d[2], _DEFAULT_TYPE), d[2], d[3])
|
(_get_category(_data), _deliv_name, _data)
|
||||||
for d in _deliverables.get_deliverables(
|
for _team, _series, _deliv_name, _data in _deliverables.get_deliverables(
|
||||||
self.team_name,
|
self.team_name,
|
||||||
series,
|
series,
|
||||||
)
|
)
|
||||||
@ -150,24 +135,24 @@ class DeliverableDirectiveBase(rst.Directive):
|
|||||||
raw_deliverables = list(raw_deliverables)
|
raw_deliverables = list(raw_deliverables)
|
||||||
grouped = itertools.groupby(
|
grouped = itertools.groupby(
|
||||||
sorted(raw_deliverables),
|
sorted(raw_deliverables),
|
||||||
key=operator.itemgetter(0), # the deliverable type
|
key=operator.itemgetter(0), # the category
|
||||||
)
|
)
|
||||||
# Convert the grouping iterators to a dictionary mapping
|
# Convert the grouping iterators to a dictionary mapping
|
||||||
# type to the list of tuples with deliverable name and
|
# type to the list of tuples with deliverable name and
|
||||||
# parsed deliverable info that _add_deliverables() needs.
|
# parsed deliverable info that _add_deliverables() needs.
|
||||||
by_type = {}
|
by_category = {}
|
||||||
for deliverable_type, deliverables in grouped:
|
for deliverable_category, deliverables in grouped:
|
||||||
by_type[deliverable_type] = [
|
by_category[deliverable_category] = [
|
||||||
(d[1], d[2])
|
(d[1], d[2])
|
||||||
for d in deliverables
|
for d in deliverables
|
||||||
]
|
]
|
||||||
for type_tag in self._TYPE_ORDER:
|
for category in self._CATEGORY_ORDER:
|
||||||
if type_tag not in by_type:
|
if category not in by_category:
|
||||||
app.info('No %r for %s' % (type_tag, (self.team_name, series)))
|
app.info('No %r for %s' % (category, (self.team_name, series)))
|
||||||
continue
|
continue
|
||||||
self._add_deliverables(
|
self._add_deliverables(
|
||||||
type_tag,
|
category,
|
||||||
by_type[type_tag],
|
by_category[category],
|
||||||
series,
|
series,
|
||||||
app,
|
app,
|
||||||
result,
|
result,
|
||||||
@ -182,11 +167,11 @@ class DeliverableDirectiveBase(rst.Directive):
|
|||||||
return node.children
|
return node.children
|
||||||
|
|
||||||
_TYPE_TITLE = {
|
_TYPE_TITLE = {
|
||||||
'type:service': 'Service Projects',
|
'service': 'Service Projects',
|
||||||
'type:horizon-plugin': 'Horizon Plugins',
|
'horizon-plugin': 'Horizon Plugins',
|
||||||
'type:library': 'Library Projects',
|
'library': 'Library Projects',
|
||||||
'type:other': 'Other Projects',
|
'other': 'Other Projects',
|
||||||
'release:cycle-trailing': 'Projects Trailing the Release Cycle',
|
'cycle-trailing': 'Projects Trailing the Release Cycle',
|
||||||
}
|
}
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
@ -394,7 +379,7 @@ def _generate_team_pages(app):
|
|||||||
|
|
||||||
|
|
||||||
def setup(app):
|
def setup(app):
|
||||||
_initialize_team_data(app)
|
_initialize_deliverable_data(app)
|
||||||
app.add_directive('deliverable', DeliverableDirective)
|
app.add_directive('deliverable', DeliverableDirective)
|
||||||
app.add_directive('independent-deliverables',
|
app.add_directive('independent-deliverables',
|
||||||
IndependentDeliverablesDirective)
|
IndependentDeliverablesDirective)
|
||||||
|
Loading…
Reference in New Issue
Block a user