releases/tools/list_weeks.py
Doug Hellmann 2d833e1dfe skeleton version of newton schedule
Add a tool to produce the schedule table, and add a table for newton's
schedule based on when the summit is and the three week period we have
for mitaka between the release and the newton summit.

Change-Id: I4a4a16426b00c5f21a10d0ce9de221d588ee5fe5
Signed-off-by: Doug Hellmann <doug@doughellmann.com>
2016-02-08 12:35:15 -05:00

75 lines
1.8 KiB
Python
Executable File

#!/usr/bin/env python
from __future__ import print_function
import argparse
import datetime
parser = argparse.ArgumentParser()
parser.add_argument(
'previous_release',
help='date of previous release, YYYY-MM-DD',
)
parser.add_argument(
'next_release',
help='date of upcoming release, YYYY-MM-DD',
)
parser.add_argument(
'summit',
help='date of upcoming summit after the release, YYYY-MM-DD',
)
args = parser.parse_args()
previous_release_date = datetime.datetime.strptime(
args.previous_release, '%Y-%m-%d')
next_release_date = datetime.datetime.strptime(
args.next_release, '%Y-%m-%d')
summit_date = datetime.datetime.strptime(
args.summit, '%Y-%m-%d')
week = datetime.timedelta(weeks=1)
work_week = datetime.timedelta(days=4)
# Build the list of Mondays leading up to the release.
weeks = []
current = previous_release_date
while current < next_release_date:
current += week
weeks.append(current)
n_weeks = len(weeks)
# Add the list of Mondays following the release leading up to the
# summit.
while current <= summit_date:
weeks.append(current)
current += week
print('''
+-------------------+---------------------------+-----------------------------+
| Week | Cross-project events | Project-specific events |
+============+======+===========================+=============================+
''', end='')
week_fmt = '''
| {:<10} | {:<4} |{:<27}|{:<29}|
+------------+------+---------------------------+-----------------------------+
'''.strip()
def show_week(week, name):
date_range = '{:%b %d}-{:%d}'.format(
week,
week + work_week,
)
print(week_fmt.format(date_range, name, '', ''))
# Print the date for the previous release
show_week(previous_release_date, '')
for n, week in enumerate(weeks, 1):
show_week(week, 'R{:<+3d}'.format(n - n_weeks))