Mercurial > hg > toybox
comparison scripts/mkstatus.py @ 1035:6b4529a50b72 draft
Update status and roadmap pages, and status page generator script.
author | Rob Landley <rob@landley.net> |
---|---|
date | Sun, 01 Sep 2013 07:25:37 -0500 |
parents | 0db28494d17d |
children | bd745ae2b115 |
comparison
equal
deleted
inserted
replaced
1034:54c9d4a0d46e | 1035:6b4529a50b72 |
---|---|
13 i=i.split() | 13 i=i.split() |
14 ret[i[0]]=i[1:] | 14 ret[i[0]]=i[1:] |
15 arr.extend(i) | 15 arr.extend(i) |
16 return ret,arr | 16 return ret,arr |
17 | 17 |
18 # Run sed on roadmap and status pages to get command lists, and run toybox too | |
19 # This gives us a dictionary of types, each with a list of commands | |
20 | |
18 stuff,blah=readit(["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"]) | 21 stuff,blah=readit(["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"]) |
22 blah,toystuff=readit(["./toybox"]) | |
19 | 23 |
20 blah,toystuff=readit(["./toybox"]) | 24 # Create reverse mappings: command is in which |
21 | 25 |
22 reverse={} | 26 reverse={} |
23 for i in stuff: | 27 for i in stuff: |
24 for j in stuff[i]: | 28 for j in stuff[i]: |
25 try: reverse[j].append(i) | 29 try: reverse[j].append(i) |
37 print "all commands=%s" % len(reverse) | 41 print "all commands=%s" % len(reverse) |
38 | 42 |
39 outfile=open("www/status.gen", "w") | 43 outfile=open("www/status.gen", "w") |
40 outfile.write("<a name=all><h2><a href=#all>All commands</a></h2><blockquote><p>\n") | 44 outfile.write("<a name=all><h2><a href=#all>All commands</a></h2><blockquote><p>\n") |
41 | 45 |
46 conv = [("posix", '<a href="http://pubs.opengroup.org/onlinepubs/9699919799/utilities/%s.html">%%s</a>', "[%s]"), | |
47 ("lsb", '<a href="http://refspecs.linuxfoundation.org/LSB_4.1.0/LSB-Core-generic/LSB-Core-generic/%s.html">%%s</a>', '<%s>'), | |
48 ("development", '<a href="http://linux.die.net/man/1/%s">%%s</a>', '(%s)'), | |
49 ("toolbox", "", '{%s}'), ("klibc_cmd", "", '=%s='), | |
50 ("sash_cmd", "", '#%s#'), ("sbase_cmd", "", '@%s@'), | |
51 ("beastiebox_cmd", "", '*%s*'), | |
52 ("request", '<a href="http://linux.die.net/man/1/%s">%%s</a>', '+%s+')] | |
53 | |
54 | |
55 def categorize(reverse, i, skippy=""): | |
56 linky = "%s" | |
57 out = i | |
58 | |
59 if skippy: types = filter(lambda a: a != skippy, reverse[i]) | |
60 else: types = reverse[i] | |
61 | |
62 for j in conv: | |
63 if j[0] in types: | |
64 if j[1]: linky = j[1] % i | |
65 out = j[2] % out | |
66 if not skippy: break | |
67 if (not skippy) and out == i: | |
68 sys.stderr.write("unknown %s %s\n" % (i,reverse[i])) | |
69 | |
70 return linky % out | |
71 | |
42 blah=list(reverse) | 72 blah=list(reverse) |
43 blah.sort() | 73 blah.sort() |
44 for i in blah: | 74 for i in blah: |
45 out=i | 75 out=categorize(reverse, i) |
46 if "posix" in reverse[i]: out='[<a href="http://pubs.opengroup.org/onlinepubs/9699919799/utilities/%s.html">%s</a>]' % (i,out) | |
47 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) | |
48 elif "development" in reverse[i]: out='(<a href="http://linux.die.net/man/1/%s">%s</a>)' % (i,out) | |
49 elif "toolbox" in reverse[i]: out='{%s}' % out | |
50 elif "klibc_cmd" in reverse[i]: out='=%s=' % out | |
51 elif "sash_cmd" in reverse[i]: out='#%s#' % out | |
52 elif "sbase_cmd" in reverse[i]: out='@%s@' % out | |
53 elif "beastiebox_cmd" in reverse[i]: out='*%s*' % out | |
54 elif "request" in reverse[i]: out='+<a href="http://linux.die.net/man/1/%s">%s</a>+' % (i,out) | |
55 elif "ready" in reverse[i]: pass | |
56 else: sys.stderr.write("unknown %s %s\n" % (i, reverse[i])) | |
57 if "ready" in reverse[i] or "pending" in reverse[i]: | 76 if "ready" in reverse[i] or "pending" in reverse[i]: |
58 done.append(out) | 77 done.append(out) |
59 out='<strike>%s</strike>' % out | 78 out='<strike>%s</strike>' % out |
60 else: pending.append(out) | 79 else: pending.append(out) |
61 | 80 |
64 print "done=%s" % len(done) | 83 print "done=%s" % len(done) |
65 outfile.write("</p></blockquote>\n") | 84 outfile.write("</p></blockquote>\n") |
66 | 85 |
67 outfile.write("<a name=todo><h2><a href=#todo>TODO</a></h2><blockquote><p>%s</p></blockquote>\n" % "\n".join(pending)) | 86 outfile.write("<a name=todo><h2><a href=#todo>TODO</a></h2><blockquote><p>%s</p></blockquote>\n" % "\n".join(pending)) |
68 outfile.write("<a name=done><h2><a href=#done>Done</a></h2><blockquote><p>%s</p></blockquote>\n" % "\n".join(done)) | 87 outfile.write("<a name=done><h2><a href=#done>Done</a></h2><blockquote><p>%s</p></blockquote>\n" % "\n".join(done)) |
88 | |
89 outfile.write("<hr><h2>Categories of remaining todo items</h2>") | |
90 | |
91 for i in stuff: | |
92 todo = [] | |
93 | |
94 for j in stuff[i]: | |
95 if "ready" in reverse[j]: continue | |
96 else: todo.append(categorize(reverse,j,i)) | |
97 | |
98 if todo: | |
99 k = i | |
100 for j in conv: | |
101 if j[0] == i: | |
102 k = j[2] % i | |
103 | |
104 outfile.write("<a name=%s><h2><a href=#%s>%s<a></h2><blockquote><p>" % (i,i,k)) | |
105 outfile.write(" ".join(todo)) | |
106 outfile.write("</p></blockquote>\n") |