add a single unified calendar file

In addition to each series-specific calendar, prepare a single global
ICS file with all calendar events in it.

Change-Id: I3b66a343d1d0eac19c212c26957cc98ecbc062de
Signed-off-by: Doug Hellmann <doug@doughellmann.com>
This commit is contained in:
Doug Hellmann
2017-01-06 15:17:44 -05:00
parent 406de70380
commit 7239f26f74
2 changed files with 37 additions and 2 deletions

View File

@@ -67,6 +67,11 @@ class ICS(rst.Directive):
return [node]
_global_calendar = icalendar.Calendar()
_global_calendar.add('prodid', '-//releases.openstack.org//EN')
_global_calendar.add('X-WR-CALNAME', 'OpenStack Release Schedule')
def doctree_resolved(app, doctree, docname):
builder = app.builder
@@ -106,7 +111,12 @@ def doctree_resolved(app, doctree, docname):
summary_text = ' (' + '; '.join(summary) + ')'
else:
summary_text = ''
event.add('summary', week['name'] + summary_text)
event.add(
'summary',
'{} {}{}'.format(series_name.title(),
week['name'],
summary_text),
)
start = datetime.datetime.strptime(week['start'], '%Y-%m-%d')
event.add('dtstart', icalendar.vDate(start.date()))
@@ -129,6 +139,7 @@ def doctree_resolved(app, doctree, docname):
event.add('description', '\n\n'.join(description))
cal.add_component(event)
_global_calendar.add_component(event)
output_full_name = os.path.join(
builder.outdir,
@@ -148,7 +159,27 @@ def doctree_resolved(app, doctree, docname):
node.parent.replace(node, [])
def build_finished(app, exception):
if exception is not None:
return
builder = app.builder
output_full_name = os.path.join(
builder.outdir,
'schedule.ics',
)
output_dir_name = os.path.dirname(output_full_name)
if not os.path.exists(output_dir_name):
os.makedirs(output_dir_name)
destination = FileOutput(
destination_path=output_full_name,
encoding='utf-8',
)
app.info('generating {}'.format(output_full_name))
destination.write(_global_calendar.to_ical())
def setup(app):
app.info('initializing ICS extension')
app.add_directive('ics', ICS)
app.connect('doctree-resolved', doctree_resolved)
app.connect('build-finished', build_finished)

View File

@@ -7,7 +7,11 @@ Release Series
OpenStack is developed and released around 6-month cycles. After the initial
release, additional stable point releases will be released in each release
series. You can find the detail of the various release series here:
series. You can find the detail of the various release series here on their
series page. Subscribe to the `combined release calendar`_ for continual
updates.
.. _combined release calendar: schedule.ics
.. list-table::
:header-rows: 1