Mercurial > hg > toybox
comparison scripts/mkstatus.py @ 635:cffb9b7f1c60
Add status.html and script to calculate it from roadmap info.
author | Rob Landley <rob@landley.net> |
---|---|
date | Sat, 21 Jul 2012 00:29:27 -0500 |
parents | |
children | 3c591e7a367d |
comparison
equal
deleted
inserted
replaced
634:8f22dbddf1e6 | 635:cffb9b7f1c60 |
---|---|
1 #!/usr/bin/python | |
2 | |
3 import subprocess,sys | |
4 | |
5 stuff={} | |
6 blob=subprocess.Popen(["sed","-n", 's/<span id=\\([a-z]*\\)>/\\1 /;t good;d;:good;h;:loop;n;s@</span>@@;t out;H;b loop;:out;g;s/\\n/ /g;p', "www/roadmap.html", "www/status.html"], stdout=subprocess.PIPE, shell=False) | |
7 for i in blob.stdout.read().split("\n"): | |
8 if not i: continue | |
9 i=i.split() | |
10 stuff[i[0]]=i[1:] | |
11 | |
12 reverse={} | |
13 for i in stuff: | |
14 for j in stuff[i]: | |
15 try: | |
16 reverse[j].append(i) | |
17 except: | |
18 reverse[j]=[i] | |
19 | |
20 pending=[] | |
21 done=[] | |
22 | |
23 outfile=open("www/status.gen", "w") | |
24 outfile.write("<h2>All commands</h2><blockquote><p>\n") | |
25 | |
26 blah=list(reverse) | |
27 blah.sort() | |
28 for i in blah: | |
29 out=i | |
30 if "posix" in reverse[i]: out='[<a href="http://opengroup.org/onlinepubs/9699919799/utilities/%s.html">%s</a>]' % (i,out) | |
31 elif "lsb" in reverse[i]: out='<<a href="http://refspecs.linuxfoundation.org/LSB_4.1.0/LSB-Core-generic/LSB-Core-generic/%s.html">%s</a>>' % (i,out) | |
32 elif "development" in reverse[i]: out='(<a href="http://linux.die.net/man/1/%s">%s</a>)' % (i,out) | |
33 elif "toolbox" in reverse[i]: out='{%s}' % out | |
34 elif "ready" in reverse[i]: pass | |
35 else: sys.stderr.write("unknown %s %s\n" % (i, reverse[i])) | |
36 | |
37 if "ready" in reverse[i] or "pending" in reverse[i]: | |
38 out='<strike>%s</strike>' % out | |
39 done.append(out) | |
40 else: pending.append(out) | |
41 | |
42 outfile.write(out+"\n") | |
43 | |
44 outfile.write("</p></blockquote>\n") | |
45 | |
46 outfile.write("<h2>TODO</h2><blockquote><p>%s</p></blockquote>\n" % "\n".join(pending)) | |
47 outfile.write("<h2>Done</h2><blockquote><p>%s</p></blockquote>\n" % "\n".join(done)) |