From e7bdd8b3a7040ffb6b9efd35d0859bec1f07928a Mon Sep 17 00:00:00 2001 From: Doug Hellmann Date: Tue, 25 Jul 2017 15:56:15 -0400 Subject: [PATCH] move series dates into generator Change-Id: If4b7ea23b0a52f863d0770a8b460e07f609a0f25 Signed-off-by: Doug Hellmann --- tools/www-generator.py | 84 ++++++++++++------- www/austin/index.html | 2 +- www/bexar/index.html | 2 +- www/cactus/index.html | 2 +- www/diablo/index.html | 2 +- www/essex/index.html | 2 +- www/folsom/index.html | 2 +- www/grizzly/index.html | 2 +- www/havana/index.html | 2 +- www/icehouse/index.html | 2 +- www/juno/index.html | 2 +- www/kilo/index.html | 2 +- www/liberty/index.html | 2 +- www/mitaka/index.html | 2 +- www/newton/index.html | 2 +- www/ocata/index.html | 2 +- www/pike/index.html | 2 +- .../dropdown_releases_and_languages.tmpl | 3 +- 18 files changed, 69 insertions(+), 50 deletions(-) diff --git a/tools/www-generator.py b/tools/www-generator.py index bf658a7272..c0ace8e4ff 100755 --- a/tools/www-generator.py +++ b/tools/www-generator.py @@ -13,6 +13,7 @@ # under the License. import argparse +import collections import glob import logging import multiprocessing @@ -29,44 +30,60 @@ import requests 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 = [ - 'austin', - 'bexar', - 'cactus', - 'diablo', - 'essex', - 'folsom', - 'grizzly', - 'havana', - 'icehouse', - 'juno', - 'kilo', - 'liberty', - 'mitaka', - 'newton', + name + for name, info in sorted(SERIES_INFO.items()) + if info.status != 'development' ] -# Set RELEASED_SERIES to the most current release that is not in -# active development. -RELEASED_SERIES = 'ocata' +# Find the most recently released series. +RELEASED_SERIES = [ + 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 -# right now. -SERIES_IN_DEVELOPMENT = 'pike' - -# List any names known for future releases here. -FUTURE_SERIES = [ - 'queens', - 'rocky', -] +# Find the series being developed. +SERIES_IN_DEVELOPMENT = [ + name + for name, info in sorted(SERIES_INFO.items()) + if info.status == 'development' +][0] # Do not modify this variable. -ALL_SERIES = ( - PAST_SERIES + - [RELEASED_SERIES, SERIES_IN_DEVELOPMENT] + - FUTURE_SERIES -) +ALL_SERIES = list(sorted(SERIES_INFO.keys())) SERIES_PAT = re.compile('^(' + '|'.join(ALL_SERIES) + ')/') @@ -336,11 +353,13 @@ def render_template(environment, project_data, regular_repos, infra_repos, if series_match: series = series_match.groups()[0] series_title = series.title() + series_info = SERIES_INFO[series] if series == SERIES_IN_DEVELOPMENT: series = 'latest' else: series = None series_title = '' + series_info = SeriesInfo('', '') logger.info('series = %s', series) try: @@ -366,6 +385,7 @@ def render_template(environment, project_data, regular_repos, infra_repos, IMAGEDIR=imagedir, SERIES=series, SERIES_TITLE=series_title, + SERIES_INFO=series_info, **extra ) if template_file.endswith('.html'): diff --git a/www/austin/index.html b/www/austin/index.html index 20722d9484..b4125f2057 100644 --- a/www/austin/index.html +++ b/www/austin/index.html @@ -29,7 +29,7 @@
-

Documentation for Austin (October 2010)

+

Documentation for {{SERIES_TITLE}} ({{SERIES_INFO.date}})

The {{SERIES_TITLE}} release of OpenStack is no diff --git a/www/bexar/index.html b/www/bexar/index.html index fb9cd7b284..b4125f2057 100644 --- a/www/bexar/index.html +++ b/www/bexar/index.html @@ -29,7 +29,7 @@

-

Documentation for Bexar (February 2011)

+

Documentation for {{SERIES_TITLE}} ({{SERIES_INFO.date}})

The {{SERIES_TITLE}} release of OpenStack is no diff --git a/www/cactus/index.html b/www/cactus/index.html index 40e9d4b83d..b4125f2057 100644 --- a/www/cactus/index.html +++ b/www/cactus/index.html @@ -29,7 +29,7 @@

-

Documentation for Cactus (April 2011)

+

Documentation for {{SERIES_TITLE}} ({{SERIES_INFO.date}})

The {{SERIES_TITLE}} release of OpenStack is no diff --git a/www/diablo/index.html b/www/diablo/index.html index df3d514e40..b4125f2057 100644 --- a/www/diablo/index.html +++ b/www/diablo/index.html @@ -29,7 +29,7 @@

-

Documentation for Diablo (September 2011)

+

Documentation for {{SERIES_TITLE}} ({{SERIES_INFO.date}})

The {{SERIES_TITLE}} release of OpenStack is no diff --git a/www/essex/index.html b/www/essex/index.html index 6bbe71275c..b4125f2057 100644 --- a/www/essex/index.html +++ b/www/essex/index.html @@ -29,7 +29,7 @@

-

Documentation for Essex (April 2012)

+

Documentation for {{SERIES_TITLE}} ({{SERIES_INFO.date}})

The {{SERIES_TITLE}} release of OpenStack is no diff --git a/www/folsom/index.html b/www/folsom/index.html index 6049bf71ce..b4125f2057 100644 --- a/www/folsom/index.html +++ b/www/folsom/index.html @@ -29,7 +29,7 @@

-

Documentation for Folsom (September 2012)

+

Documentation for {{SERIES_TITLE}} ({{SERIES_INFO.date}})

The {{SERIES_TITLE}} release of OpenStack is no diff --git a/www/grizzly/index.html b/www/grizzly/index.html index d7e27f4c50..b4125f2057 100644 --- a/www/grizzly/index.html +++ b/www/grizzly/index.html @@ -29,7 +29,7 @@

-

Documentation for Grizzly (April 2013)

+

Documentation for {{SERIES_TITLE}} ({{SERIES_INFO.date}})

The {{SERIES_TITLE}} release of OpenStack is no diff --git a/www/havana/index.html b/www/havana/index.html index c4da59aaa5..cffdc3352f 100644 --- a/www/havana/index.html +++ b/www/havana/index.html @@ -29,7 +29,7 @@

-

Documentation for Havana (October 2013)

+

Documentation for {{SERIES_TITLE}} ({{SERIES_INFO.date}})

The {{SERIES_TITLE}} release of OpenStack is no diff --git a/www/icehouse/index.html b/www/icehouse/index.html index 7f66d07cfe..807cf9e42c 100644 --- a/www/icehouse/index.html +++ b/www/icehouse/index.html @@ -36,7 +36,7 @@

-

Documentation for Icehouse (April 2014)

+

Documentation for {{SERIES_TITLE}} ({{SERIES_INFO.date}})

The {{SERIES_TITLE}} release of OpenStack is no longer supported by the community. For more diff --git a/www/juno/index.html b/www/juno/index.html index 22dc1e0cf3..ad8bb7660e 100644 --- a/www/juno/index.html +++ b/www/juno/index.html @@ -36,7 +36,7 @@

-

Documentation for Juno (October 2014)

+

Documentation for {{SERIES_TITLE}} ({{SERIES_INFO.date}})

The {{SERIES_TITLE}} release of OpenStack is no longer supported by the community. For more diff --git a/www/kilo/index.html b/www/kilo/index.html index 6c451c6baf..8f97610cf6 100644 --- a/www/kilo/index.html +++ b/www/kilo/index.html @@ -36,7 +36,7 @@

-

Documentation for Kilo (April 2015)

+

Documentation for {{SERIES_TITLE}} ({{SERIES_INFO.date}})

The {{SERIES_TITLE}} release of OpenStack is no longer supported by the community. For more diff --git a/www/liberty/index.html b/www/liberty/index.html index d25eec31d9..d9067f415d 100644 --- a/www/liberty/index.html +++ b/www/liberty/index.html @@ -36,7 +36,7 @@

-

Documentation for Liberty (October 2015)

+

Documentation for {{SERIES_TITLE}} ({{SERIES_INFO.date}})

The {{SERIES_TITLE}} release of OpenStack is no longer supported by the community. For more diff --git a/www/mitaka/index.html b/www/mitaka/index.html index 0b08f84dcd..475456a764 100644 --- a/www/mitaka/index.html +++ b/www/mitaka/index.html @@ -29,7 +29,7 @@

-

Documentation for Mitaka (April 2016)

+

Documentation for {{SERIES_TITLE}} ({{SERIES_INFO.date}})

This is not the latest release. Use the menu to select a different release if needed.

{% include 'templates/dropdown_releases_and_languages.tmpl' %} diff --git a/www/newton/index.html b/www/newton/index.html index 725251e2dd..0ff099b549 100644 --- a/www/newton/index.html +++ b/www/newton/index.html @@ -29,7 +29,7 @@
-

Documentation for Newton (October 2016)

+

Documentation for {{SERIES_TITLE}} ({{SERIES_INFO.date}})

This is not the latest release. Use the menu to select a different release if needed.

{% include 'templates/dropdown_releases_and_languages.tmpl' %} diff --git a/www/ocata/index.html b/www/ocata/index.html index bd055b0b10..61b054776d 100644 --- a/www/ocata/index.html +++ b/www/ocata/index.html @@ -29,7 +29,7 @@
-

Documentation for Ocata (February 2017)

+

Documentation for {{SERIES_TITLE}} ({{SERIES_INFO.date}})

This is the latest release. Use the menu to select a prior release if needed.

{% include 'templates/dropdown_releases_and_languages.tmpl' %} diff --git a/www/pike/index.html b/www/pike/index.html index 240b20c611..4faaf8c6e2 100644 --- a/www/pike/index.html +++ b/www/pike/index.html @@ -29,7 +29,7 @@
-

Documentation for Pike (September 2017)

+

Documentation for {{SERIES_TITLE}} ({{SERIES_INFO.date}})

This is the latest release. Use the menu to select a prior release if needed.

{% include 'templates/dropdown_releases_and_languages.tmpl' %} diff --git a/www/templates/dropdown_releases_and_languages.tmpl b/www/templates/dropdown_releases_and_languages.tmpl index 422298836e..840f9502da 100644 --- a/www/templates/dropdown_releases_and_languages.tmpl +++ b/www/templates/dropdown_releases_and_languages.tmpl @@ -4,9 +4,8 @@