move series dates into generator

Change-Id: If4b7ea23b0a52f863d0770a8b460e07f609a0f25
Signed-off-by: Doug Hellmann <doug@doughellmann.com>
This commit is contained in:
Doug Hellmann 2017-07-25 15:56:15 -04:00
parent 59c3a9847a
commit e7bdd8b3a7
18 changed files with 69 additions and 50 deletions

View File

@ -13,6 +13,7 @@
# under the License. # under the License.
import argparse import argparse
import collections
import glob import glob
import logging import logging
import multiprocessing import multiprocessing
@ -29,44 +30,60 @@ import requests
import yaml import yaml
# List previously released series. SeriesInfo = collections.namedtuple('SeriesInfo', 'date status')
# The 'date' should be a string containing the month name and 4 digit year.
#
# The 'status' field should be one of:
# 'obsolete' -- the release existed, but we have no more artifacts for it
# 'EOL' -- the release is closed but we have docs for it
# 'maintained' -- the release still has an open branch
# 'development' -- the current release being developed
SERIES_INFO = {
'austin': SeriesInfo(date='October 2010', status='obsolete'),
'bexar': SeriesInfo(date='February 2011', status='obsolete'),
'cactus': SeriesInfo(date='April 2011', status='obsolete'),
'diablo': SeriesInfo(date='September 2011', status='obsolete'),
'essex': SeriesInfo(date='April 2012', status='obsolete'),
'folsom': SeriesInfo(date='September 2012', status='obsolete'),
'grizzly': SeriesInfo(date='April 2013', status='obsolete'),
'havana': SeriesInfo(date='October 2013', status='obsolete'),
'icehouse': SeriesInfo(date='April 2014', status='EOL'),
'juno': SeriesInfo(date='October 2014', status='EOL'),
'kilo': SeriesInfo(date='April 2015', status='EOL'),
'liberty': SeriesInfo(date='October 2015', status='EOL'),
'mitaka': SeriesInfo(date='April 2016', status='EOL'),
'newton': SeriesInfo(date='October 2016', status='maintained'),
'ocata': SeriesInfo(date='February 2017', status='maintained'),
'pike': SeriesInfo(date='August 2017', status='development'),
# 'queens': SeriesInfo(),
# 'rocky': SeriesInfo(),
}
# Build a list of the series that are not the current series being
# developed.
PAST_SERIES = [ PAST_SERIES = [
'austin', name
'bexar', for name, info in sorted(SERIES_INFO.items())
'cactus', if info.status != 'development'
'diablo',
'essex',
'folsom',
'grizzly',
'havana',
'icehouse',
'juno',
'kilo',
'liberty',
'mitaka',
'newton',
] ]
# Set RELEASED_SERIES to the most current release that is not in # Find the most recently released series.
# active development. RELEASED_SERIES = [
RELEASED_SERIES = 'ocata' name
for name, info in sorted(SERIES_INFO.items())
if info.status == 'maintained'
][-1]
# Set SERIES_IN_DEVELOPMENT to the name of the series being developed # Find the series being developed.
# right now. SERIES_IN_DEVELOPMENT = [
SERIES_IN_DEVELOPMENT = 'pike' name
for name, info in sorted(SERIES_INFO.items())
# List any names known for future releases here. if info.status == 'development'
FUTURE_SERIES = [ ][0]
'queens',
'rocky',
]
# Do not modify this variable. # Do not modify this variable.
ALL_SERIES = ( ALL_SERIES = list(sorted(SERIES_INFO.keys()))
PAST_SERIES +
[RELEASED_SERIES, SERIES_IN_DEVELOPMENT] +
FUTURE_SERIES
)
SERIES_PAT = re.compile('^(' + '|'.join(ALL_SERIES) + ')/') SERIES_PAT = re.compile('^(' + '|'.join(ALL_SERIES) + ')/')
@ -336,11 +353,13 @@ def render_template(environment, project_data, regular_repos, infra_repos,
if series_match: if series_match:
series = series_match.groups()[0] series = series_match.groups()[0]
series_title = series.title() series_title = series.title()
series_info = SERIES_INFO[series]
if series == SERIES_IN_DEVELOPMENT: if series == SERIES_IN_DEVELOPMENT:
series = 'latest' series = 'latest'
else: else:
series = None series = None
series_title = '' series_title = ''
series_info = SeriesInfo('', '')
logger.info('series = %s', series) logger.info('series = %s', series)
try: try:
@ -366,6 +385,7 @@ def render_template(environment, project_data, regular_repos, infra_repos,
IMAGEDIR=imagedir, IMAGEDIR=imagedir,
SERIES=series, SERIES=series,
SERIES_TITLE=series_title, SERIES_TITLE=series_title,
SERIES_INFO=series_info,
**extra **extra
) )
if template_file.endswith('.html'): if template_file.endswith('.html'):

View File

@ -29,7 +29,7 @@
<div class="container"> <div class="container">
<div class="row"> <div class="row">
<div class="col-lg-9 col-md-9 col-sm-9"> <div class="col-lg-9 col-md-9 col-sm-9">
<h2>Documentation for Austin (October 2010)</h2> <h2>Documentation for {{SERIES_TITLE}} ({{SERIES_INFO.date}})</h2>
<p> <p>
The {{SERIES_TITLE}} release of OpenStack is no The {{SERIES_TITLE}} release of OpenStack is no

View File

@ -29,7 +29,7 @@
<div class="container"> <div class="container">
<div class="row"> <div class="row">
<div class="col-lg-9 col-md-9 col-sm-9"> <div class="col-lg-9 col-md-9 col-sm-9">
<h2>Documentation for Bexar (February 2011)</h2> <h2>Documentation for {{SERIES_TITLE}} ({{SERIES_INFO.date}})</h2>
<p> <p>
The {{SERIES_TITLE}} release of OpenStack is no The {{SERIES_TITLE}} release of OpenStack is no

View File

@ -29,7 +29,7 @@
<div class="container"> <div class="container">
<div class="row"> <div class="row">
<div class="col-lg-9 col-md-9 col-sm-9"> <div class="col-lg-9 col-md-9 col-sm-9">
<h2>Documentation for Cactus (April 2011)</h2> <h2>Documentation for {{SERIES_TITLE}} ({{SERIES_INFO.date}})</h2>
<p> <p>
The {{SERIES_TITLE}} release of OpenStack is no The {{SERIES_TITLE}} release of OpenStack is no

View File

@ -29,7 +29,7 @@
<div class="container"> <div class="container">
<div class="row"> <div class="row">
<div class="col-lg-9 col-md-9 col-sm-9"> <div class="col-lg-9 col-md-9 col-sm-9">
<h2>Documentation for Diablo (September 2011)</h2> <h2>Documentation for {{SERIES_TITLE}} ({{SERIES_INFO.date}})</h2>
<p> <p>
The {{SERIES_TITLE}} release of OpenStack is no The {{SERIES_TITLE}} release of OpenStack is no

View File

@ -29,7 +29,7 @@
<div class="container"> <div class="container">
<div class="row"> <div class="row">
<div class="col-lg-9 col-md-9 col-sm-9"> <div class="col-lg-9 col-md-9 col-sm-9">
<h2>Documentation for Essex (April 2012)</h2> <h2>Documentation for {{SERIES_TITLE}} ({{SERIES_INFO.date}})</h2>
<p> <p>
The {{SERIES_TITLE}} release of OpenStack is no The {{SERIES_TITLE}} release of OpenStack is no

View File

@ -29,7 +29,7 @@
<div class="container"> <div class="container">
<div class="row"> <div class="row">
<div class="col-lg-9 col-md-9 col-sm-9"> <div class="col-lg-9 col-md-9 col-sm-9">
<h2>Documentation for Folsom (September 2012)</h2> <h2>Documentation for {{SERIES_TITLE}} ({{SERIES_INFO.date}})</h2>
<p> <p>
The {{SERIES_TITLE}} release of OpenStack is no The {{SERIES_TITLE}} release of OpenStack is no

View File

@ -29,7 +29,7 @@
<div class="container"> <div class="container">
<div class="row"> <div class="row">
<div class="col-lg-9 col-md-9 col-sm-9"> <div class="col-lg-9 col-md-9 col-sm-9">
<h2>Documentation for Grizzly (April 2013)</h2> <h2>Documentation for {{SERIES_TITLE}} ({{SERIES_INFO.date}})</h2>
<p> <p>
The {{SERIES_TITLE}} release of OpenStack is no The {{SERIES_TITLE}} release of OpenStack is no

View File

@ -29,7 +29,7 @@
<div class="container"> <div class="container">
<div class="row"> <div class="row">
<div class="col-lg-9 col-md-9 col-sm-9"> <div class="col-lg-9 col-md-9 col-sm-9">
<h2>Documentation for Havana (October 2013)</h2> <h2>Documentation for {{SERIES_TITLE}} ({{SERIES_INFO.date}})</h2>
<p> <p>
The {{SERIES_TITLE}} release of OpenStack is no The {{SERIES_TITLE}} release of OpenStack is no

View File

@ -36,7 +36,7 @@
<div class="row"> <div class="row">
<div class="col-lg-9 col-md-9 col-sm-9"> <div class="col-lg-9 col-md-9 col-sm-9">
<h2>Documentation for Icehouse (April 2014)</h2> <h2>Documentation for {{SERIES_TITLE}} ({{SERIES_INFO.date}})</h2>
<p> <p>
The {{SERIES_TITLE}} release of OpenStack is no The {{SERIES_TITLE}} release of OpenStack is no
longer supported by the community. For more longer supported by the community. For more

View File

@ -36,7 +36,7 @@
<div class="row"> <div class="row">
<div class="col-lg-9 col-md-9 col-sm-9"> <div class="col-lg-9 col-md-9 col-sm-9">
<h2>Documentation for Juno (October 2014)</h2> <h2>Documentation for {{SERIES_TITLE}} ({{SERIES_INFO.date}})</h2>
<p> <p>
The {{SERIES_TITLE}} release of OpenStack is no The {{SERIES_TITLE}} release of OpenStack is no
longer supported by the community. For more longer supported by the community. For more

View File

@ -36,7 +36,7 @@
<div class="row"> <div class="row">
<div class="col-lg-9 col-md-9 col-sm-9"> <div class="col-lg-9 col-md-9 col-sm-9">
<h2>Documentation for Kilo (April 2015)</h2> <h2>Documentation for {{SERIES_TITLE}} ({{SERIES_INFO.date}})</h2>
<p> <p>
The {{SERIES_TITLE}} release of OpenStack is no The {{SERIES_TITLE}} release of OpenStack is no
longer supported by the community. For more longer supported by the community. For more

View File

@ -36,7 +36,7 @@
<div class="row"> <div class="row">
<div class="col-lg-9 col-md-9 col-sm-9"> <div class="col-lg-9 col-md-9 col-sm-9">
<h2>Documentation for Liberty (October 2015)</h2> <h2>Documentation for {{SERIES_TITLE}} ({{SERIES_INFO.date}})</h2>
<p> <p>
The {{SERIES_TITLE}} release of OpenStack is no The {{SERIES_TITLE}} release of OpenStack is no
longer supported by the community. For more longer supported by the community. For more

View File

@ -29,7 +29,7 @@
<div class="container"> <div class="container">
<div class="row"> <div class="row">
<div class="col-lg-9 col-md-9 col-sm-9"> <div class="col-lg-9 col-md-9 col-sm-9">
<h2>Documentation for Mitaka (April 2016)</h2> <h2>Documentation for {{SERIES_TITLE}} ({{SERIES_INFO.date}})</h2>
<p>This is not the latest release. Use the menu to select a different release if needed.</p> <p>This is not the latest release. Use the menu to select a different release if needed.</p>
</div> </div>
{% include 'templates/dropdown_releases_and_languages.tmpl' %} {% include 'templates/dropdown_releases_and_languages.tmpl' %}

View File

@ -29,7 +29,7 @@
<div class="container"> <div class="container">
<div class="row"> <div class="row">
<div class="col-lg-9 col-md-9 col-sm-9"> <div class="col-lg-9 col-md-9 col-sm-9">
<h2>Documentation for Newton (October 2016)</h2> <h2>Documentation for {{SERIES_TITLE}} ({{SERIES_INFO.date}})</h2>
<p>This is not the latest release. Use the menu to select a different release if needed.</p> <p>This is not the latest release. Use the menu to select a different release if needed.</p>
</div> </div>
{% include 'templates/dropdown_releases_and_languages.tmpl' %} {% include 'templates/dropdown_releases_and_languages.tmpl' %}

View File

@ -29,7 +29,7 @@
<div class="container"> <div class="container">
<div class="row"> <div class="row">
<div class="col-lg-9 col-md-9 col-sm-9"> <div class="col-lg-9 col-md-9 col-sm-9">
<h2>Documentation for Ocata (February 2017)</h2> <h2>Documentation for {{SERIES_TITLE}} ({{SERIES_INFO.date}})</h2>
<p>This is the latest release. Use the menu to select a prior release if needed.</p> <p>This is the latest release. Use the menu to select a prior release if needed.</p>
</div> </div>
{% include 'templates/dropdown_releases_and_languages.tmpl' %} {% include 'templates/dropdown_releases_and_languages.tmpl' %}

View File

@ -29,7 +29,7 @@
<div class="container"> <div class="container">
<div class="row"> <div class="row">
<div class="col-lg-9 col-md-9 col-sm-9"> <div class="col-lg-9 col-md-9 col-sm-9">
<h2>Documentation for Pike (September 2017)</h2> <h2>Documentation for {{SERIES_TITLE}} ({{SERIES_INFO.date}})</h2>
<p>This is the latest release. Use the menu to select a prior release if needed.</p> <p>This is the latest release. Use the menu to select a prior release if needed.</p>
</div> </div>
{% include 'templates/dropdown_releases_and_languages.tmpl' %} {% include 'templates/dropdown_releases_and_languages.tmpl' %}

View File

@ -4,9 +4,8 @@
<ul class="dropdown-menu" role="menu" aria-labelledby="dLabel"> <ul class="dropdown-menu" role="menu" aria-labelledby="dLabel">
<li role="presentation" class="dropdown-header">Releases</li> <li role="presentation" class="dropdown-header">Releases</li>
<li role="presentation"><a role="menuitem" tabindex="-1" href="/{{SERIES_IN_DEVELOPMENT}}">{{SERIES_IN_DEVELOPMENT|title}} (under development)</a></li> <li role="presentation"><a role="menuitem" tabindex="-1" href="/{{SERIES_IN_DEVELOPMENT}}">{{SERIES_IN_DEVELOPMENT|title}} (under development)</a></li>
<li role="presentation"><a role="menuitem" tabindex="-1" href="/{{RELEASED_SERIES}}">{{RELEASED_SERIES|title}} (current release)</a></li>
{% for series_name in PAST_SERIES|reverse %} {% for series_name in PAST_SERIES|reverse %}
<li role="presentation"><a role="menuitem" tabindex="-1" href="/{{series_name}}">{{series_name|title}}</a></li> <li role="presentation"><a role="menuitem" tabindex="-1" href="/{{series_name}}">{{series_name|title}}{% if series_name == RELEASED_SERIES %} (current release){% endif %}</a></li>
{% endfor %} {% endfor %}
<li role="presentation" class="dropdown-header">Languages</li> <li role="presentation" class="dropdown-header">Languages</li>
<li role="presentation"><a role="menuitem" tabindex="-1" href="/de">Deutsch (German)</a></li> <li role="presentation"><a role="menuitem" tabindex="-1" href="/de">Deutsch (German)</a></li>