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
46
47
48
49
50
|
#!/usr/bin/env python
import sys
import datetime
months = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun',
'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec']
print '<table width="100%">'
def row(*cells, **kw):
td = kw.get('tr','td')
print ' <tr>'
for cell in cells:
print ' <%s>%s</%s>' % (td,cell,td)
print ' </tr>'
row('Estimated date', 'Type', '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(None, 1)
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 = 'Ckpt'
elif type == 'rc':
category = 'RC'
else:
category = current = type
row(date, category, desc)
print '</table>'
# Local Variables:
# tab-width:4
# indent-tabs-mode:nil
# End:
# vim: set expandtab tabstop=4 shiftwidth=4:
|