#!/usr/bin/python # Create status.html import subprocess,sys def readit(args): ret={} arr=[] blob=subprocess.Popen(args, stdout=subprocess.PIPE, shell=False) for i in blob.stdout.read().split("\n"): if not i: continue i=i.split() ret[i[0]]=i[1:] arr.extend(i) return ret,arr # Run sed on roadmap and status pages to get command lists, and run toybox too # This gives us a dictionary of types, each with a list of commands stuff,blah=readit(["sed","-n", 's//\\1 /;t good;d;:good;h;:loop;n;s@@@;t out;H;b loop;:out;g;s/\\n/ /g;p', "www/roadmap.html", "www/status.html"]) blah,toystuff=readit(["./toybox"]) # Create reverse mappings: command is in which reverse={} for i in stuff: for j in stuff[i]: try: reverse[j].append(i) except: reverse[j]=[i] for i in toystuff: try: if ("ready" in reverse[i]) or ("pending" in reverse[i]): continue except: pass print i pending=[] done=[] print "all commands=%s" % len(reverse) outfile=open("www/status.gen", "w") outfile.write("

All commands

\n") conv = [("posix", '%%s', "[%s]"), ("lsb", '%%s', '<%s>'), ("development", '%%s', '(%s)'), ("toolbox", "", '{%s}'), ("klibc_cmd", "", '=%s='), ("sash_cmd", "", '#%s#'), ("sbase_cmd", "", '@%s@'), ("beastiebox_cmd", "", '*%s*'), ("request", '%%s', '+%s+')] def categorize(reverse, i, skippy=""): linky = "%s" out = i if skippy: types = filter(lambda a: a != skippy, reverse[i]) else: types = reverse[i] for j in conv: if j[0] in types: if j[1]: linky = j[1] % i out = j[2] % out if not skippy: break if (not skippy) and out == i: sys.stderr.write("unknown %s %s\n" % (i,reverse[i])) return linky % out blah=list(reverse) blah.sort() for i in blah: out=categorize(reverse, i) if "ready" in reverse[i] or "pending" in reverse[i]: done.append(out) out='%s' % out else: pending.append(out) outfile.write(out+"\n") print "done=%s" % len(done) outfile.write("

\n") outfile.write("

TODO

%s

\n" % "\n".join(pending)) outfile.write("

Done

%s

\n" % "\n".join(done)) outfile.write("

Categories of remaining todo items

") for i in stuff: todo = [] for j in stuff[i]: if "ready" in reverse[j]: continue elif "pending" in reverse[j]: todo.append('%s' % j) else: todo.append(categorize(reverse,j,i)) if todo: k = i for j in conv: if j[0] == i: k = j[2] % i outfile.write("

%s

" % (i,i,k)) outfile.write(" ".join(todo)) outfile.write("

\n")