summaryrefslogtreecommitdiff
path: root/www/gen_sched_table.py
blob: 6d7e66147e1795da7b4450cf293d7b2a020ecfc1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
#!/usr/bin/env python

import sys
import datetime

months = ['January', 'February', 'March', 'April', 'May', 'June', 'July',
	  'August', 'September', 'October', 'November', 'December']

print '<table>'
def row(*cells, **kw):
	tr = kw.get('tr','tr')
	print '  <tr>'
	for cell in cells:
		print '    <%s>%s</%s>' % (tr,cell,tr)
	print '  </tr>'
row('Estimated date', 'Type', 'Name', 'Comments', tr = 'th')

if len(sys.argv) > 1:
	f = open(sys.argv[1])
else:	f = open('Schedule')
now = None
current = 'UNKNOWN'
for line in f:
	if line[0] == '#': continue	# comment
	if line[0] == '=':
		date,current = line[1:].strip().split()
		now = datetime.date(*tuple([int(i) for i in date.split('-')]))
		continue
	if line[0] == '+':
		incr,type,desc = line[1:].strip().split(None,2)
		now = now + datetime.timedelta(int(incr))
	else:
		print 'dunna understand code', line[0]
		sys.exit(1)
	name = current + '.d' + str(now).replace('-','')
	date = '%s %s %s' % (now.day,months[now.month-1],now.year)
	if type == 'ck':
		category = 'checkpoint'
	elif type == 'rc':
		category = 'candidate'
	else:
		current = name = type
		category = 'release'
	row(date, category, name, desc)
print '</table>'