add an "etherpad" format option to list-weeks script

Add an output option for building the schedule planning calendar
etherpad.

Change-Id: I3be5d94a1cb243a8d9e601b51959a1d97ba93083
Signed-off-by: Doug Hellmann <doug@doughellmann.com>
This commit is contained in:
Doug Hellmann 2016-04-15 09:10:37 -04:00
parent 71b772dce3
commit 2d42608486

View File

@ -7,6 +7,12 @@ import datetime
parser = argparse.ArgumentParser()
parser.add_argument(
'--etherpad',
default=False,
action='store_true',
help='output in etherpad format for building the release planning doc',
)
parser.add_argument(
'previous_release',
help='monday of the week of previous release, YYYY-MM-DD',
@ -49,24 +55,32 @@ while current <= summit_date:
weeks.append(current)
current += week
print('''
HEADER = '''
+-------------------+---------------------------+-----------------------------+
| Week | Cross-project events | Project-specific events |
+============+======+===========================+=============================+
''', end='')
'''
week_fmt = '''
if not args.etherpad:
print(HEADER, end='')
TABLE_FORMAT = '''
| {:<10} | {:<4} |{:<27}|{:<29}|
+------------+------+---------------------------+-----------------------------+
'''.strip()
ETHERPAD_FORMAT = '{} ({})'
def show_week(week, name):
date_range = '{:%b %d}-{:%d}'.format(
week,
week + work_week,
)
print(week_fmt.format(date_range, name, '', ''))
if not args.etherpad:
print(TABLE_FORMAT.format(date_range, name, '', ''))
else:
print(ETHERPAD_FORMAT.format(name, date_range))
# Print the date for the previous release