Eliminate / replace remaining cPickle references in test scripts.
[scons.git] / www / gen_sched_table.py
1 #!/usr/bin/env python
2
3 import sys
4 import datetime
5
6 months = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun',
7           'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec']
8
9 print '<table width="100%">'
10 def row(*cells, **kw):
11         td = kw.get('tr','td')
12         print '  <tr>'
13         for cell in cells:
14                 print '    <%s>%s</%s>' % (td,cell,td)
15         print '  </tr>'
16 row('Estimated&nbsp;date', 'Type', 'Comments', tr = 'th')
17
18 if len(sys.argv) > 1:
19         f = open(sys.argv[1])
20 else:   f = open('schedule')
21 now = None
22 current = 'UNKNOWN'
23 for line in f:
24         if line[0] == '#': continue     # comment
25         if line[0] == '=':
26                 date,current = line[1:].strip().split(None, 1)
27                 now = datetime.date(*tuple([int(i) for i in date.split('-')]))
28                 continue
29         if line[0] == '+':
30                 incr,type,desc = line[1:].strip().split(None,2)
31                 now = now + datetime.timedelta(int(incr))
32         else:
33                 print 'dunna understand code', line[0]
34                 sys.exit(1)
35         #name = current + '.d' + str(now).replace('-','')
36         date = '%s-%s-%s' % (now.day,months[now.month-1],now.year)
37         if type == 'ck':
38                 category = 'Ckpt'
39         elif type == 'rc':
40                 category = 'RC'
41         else:
42                 category = current = type
43         row(date, category, desc)
44 print '</table>'
45
46 # Local Variables:
47 # tab-width:4
48 # indent-tabs-mode:nil
49 # End:
50 # vim: set expandtab tabstop=4 shiftwidth=4: