annotate scripts/mkstatus.py @ 978:6d3c39cb8a9d

Cleanup renice and implement '|' (required option) in argument parsing.
author Rob Landley <rob@landley.net>
date Wed, 31 Jul 2013 03:24:58 -0500
parents 0db28494d17d
children 6b4529a50b72
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
635
cffb9b7f1c60 Add status.html and script to calculate it from roadmap info.
Rob Landley <rob@landley.net>
parents:
diff changeset
1 #!/usr/bin/python
cffb9b7f1c60 Add status.html and script to calculate it from roadmap info.
Rob Landley <rob@landley.net>
parents:
diff changeset
2
805
0db28494d17d Accumulated web page changes. (Release announcement for previous release, roadmap updates, etc.)
Rob Landley <rob@landley.net>
parents: 757
diff changeset
3 # Create status.html
0db28494d17d Accumulated web page changes. (Release announcement for previous release, roadmap updates, etc.)
Rob Landley <rob@landley.net>
parents: 757
diff changeset
4
635
cffb9b7f1c60 Add status.html and script to calculate it from roadmap info.
Rob Landley <rob@landley.net>
parents:
diff changeset
5 import subprocess,sys
cffb9b7f1c60 Add status.html and script to calculate it from roadmap info.
Rob Landley <rob@landley.net>
parents:
diff changeset
6
757
4094f14c47a2 Update mkstatus.py, roadmap.html, and status.html.
Rob Landley <rob@landley.net>
parents: 731
diff changeset
7 def readit(args):
4094f14c47a2 Update mkstatus.py, roadmap.html, and status.html.
Rob Landley <rob@landley.net>
parents: 731
diff changeset
8 ret={}
4094f14c47a2 Update mkstatus.py, roadmap.html, and status.html.
Rob Landley <rob@landley.net>
parents: 731
diff changeset
9 arr=[]
4094f14c47a2 Update mkstatus.py, roadmap.html, and status.html.
Rob Landley <rob@landley.net>
parents: 731
diff changeset
10 blob=subprocess.Popen(args, stdout=subprocess.PIPE, shell=False)
4094f14c47a2 Update mkstatus.py, roadmap.html, and status.html.
Rob Landley <rob@landley.net>
parents: 731
diff changeset
11 for i in blob.stdout.read().split("\n"):
4094f14c47a2 Update mkstatus.py, roadmap.html, and status.html.
Rob Landley <rob@landley.net>
parents: 731
diff changeset
12 if not i: continue
4094f14c47a2 Update mkstatus.py, roadmap.html, and status.html.
Rob Landley <rob@landley.net>
parents: 731
diff changeset
13 i=i.split()
4094f14c47a2 Update mkstatus.py, roadmap.html, and status.html.
Rob Landley <rob@landley.net>
parents: 731
diff changeset
14 ret[i[0]]=i[1:]
4094f14c47a2 Update mkstatus.py, roadmap.html, and status.html.
Rob Landley <rob@landley.net>
parents: 731
diff changeset
15 arr.extend(i)
4094f14c47a2 Update mkstatus.py, roadmap.html, and status.html.
Rob Landley <rob@landley.net>
parents: 731
diff changeset
16 return ret,arr
635
cffb9b7f1c60 Add status.html and script to calculate it from roadmap info.
Rob Landley <rob@landley.net>
parents:
diff changeset
17
757
4094f14c47a2 Update mkstatus.py, roadmap.html, and status.html.
Rob Landley <rob@landley.net>
parents: 731
diff changeset
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"])
4094f14c47a2 Update mkstatus.py, roadmap.html, and status.html.
Rob Landley <rob@landley.net>
parents: 731
diff changeset
19
4094f14c47a2 Update mkstatus.py, roadmap.html, and status.html.
Rob Landley <rob@landley.net>
parents: 731
diff changeset
20 blah,toystuff=readit(["./toybox"])
639
3c591e7a367d More web page roadmap/status update stuff.
Rob Landley <rob@landley.net>
parents: 635
diff changeset
21
635
cffb9b7f1c60 Add status.html and script to calculate it from roadmap info.
Rob Landley <rob@landley.net>
parents:
diff changeset
22 reverse={}
cffb9b7f1c60 Add status.html and script to calculate it from roadmap info.
Rob Landley <rob@landley.net>
parents:
diff changeset
23 for i in stuff:
cffb9b7f1c60 Add status.html and script to calculate it from roadmap info.
Rob Landley <rob@landley.net>
parents:
diff changeset
24 for j in stuff[i]:
757
4094f14c47a2 Update mkstatus.py, roadmap.html, and status.html.
Rob Landley <rob@landley.net>
parents: 731
diff changeset
25 try: reverse[j].append(i)
4094f14c47a2 Update mkstatus.py, roadmap.html, and status.html.
Rob Landley <rob@landley.net>
parents: 731
diff changeset
26 except: reverse[j]=[i]
4094f14c47a2 Update mkstatus.py, roadmap.html, and status.html.
Rob Landley <rob@landley.net>
parents: 731
diff changeset
27
4094f14c47a2 Update mkstatus.py, roadmap.html, and status.html.
Rob Landley <rob@landley.net>
parents: 731
diff changeset
28 for i in toystuff:
4094f14c47a2 Update mkstatus.py, roadmap.html, and status.html.
Rob Landley <rob@landley.net>
parents: 731
diff changeset
29 try:
4094f14c47a2 Update mkstatus.py, roadmap.html, and status.html.
Rob Landley <rob@landley.net>
parents: 731
diff changeset
30 if ("ready" in reverse[i]) or ("pending" in reverse[i]): continue
4094f14c47a2 Update mkstatus.py, roadmap.html, and status.html.
Rob Landley <rob@landley.net>
parents: 731
diff changeset
31 except: pass
4094f14c47a2 Update mkstatus.py, roadmap.html, and status.html.
Rob Landley <rob@landley.net>
parents: 731
diff changeset
32 print i
635
cffb9b7f1c60 Add status.html and script to calculate it from roadmap info.
Rob Landley <rob@landley.net>
parents:
diff changeset
33
cffb9b7f1c60 Add status.html and script to calculate it from roadmap info.
Rob Landley <rob@landley.net>
parents:
diff changeset
34 pending=[]
cffb9b7f1c60 Add status.html and script to calculate it from roadmap info.
Rob Landley <rob@landley.net>
parents:
diff changeset
35 done=[]
cffb9b7f1c60 Add status.html and script to calculate it from roadmap info.
Rob Landley <rob@landley.net>
parents:
diff changeset
36
805
0db28494d17d Accumulated web page changes. (Release announcement for previous release, roadmap updates, etc.)
Rob Landley <rob@landley.net>
parents: 757
diff changeset
37 print "all commands=%s" % len(reverse)
0db28494d17d Accumulated web page changes. (Release announcement for previous release, roadmap updates, etc.)
Rob Landley <rob@landley.net>
parents: 757
diff changeset
38
635
cffb9b7f1c60 Add status.html and script to calculate it from roadmap info.
Rob Landley <rob@landley.net>
parents:
diff changeset
39 outfile=open("www/status.gen", "w")
731
76e7bf56b2e6 Generate status page with new pubs.opengroup.org urls.
Rob Landley <rob@landley.net>
parents: 678
diff changeset
40 outfile.write("<a name=all><h2><a href=#all>All commands</a></h2><blockquote><p>\n")
635
cffb9b7f1c60 Add status.html and script to calculate it from roadmap info.
Rob Landley <rob@landley.net>
parents:
diff changeset
41
cffb9b7f1c60 Add status.html and script to calculate it from roadmap info.
Rob Landley <rob@landley.net>
parents:
diff changeset
42 blah=list(reverse)
cffb9b7f1c60 Add status.html and script to calculate it from roadmap info.
Rob Landley <rob@landley.net>
parents:
diff changeset
43 blah.sort()
cffb9b7f1c60 Add status.html and script to calculate it from roadmap info.
Rob Landley <rob@landley.net>
parents:
diff changeset
44 for i in blah:
cffb9b7f1c60 Add status.html and script to calculate it from roadmap info.
Rob Landley <rob@landley.net>
parents:
diff changeset
45 out=i
731
76e7bf56b2e6 Generate status page with new pubs.opengroup.org urls.
Rob Landley <rob@landley.net>
parents: 678
diff changeset
46 if "posix" in reverse[i]: out='[<a href="http://pubs.opengroup.org/onlinepubs/9699919799/utilities/%s.html">%s</a>]' % (i,out)
635
cffb9b7f1c60 Add status.html and script to calculate it from roadmap info.
Rob Landley <rob@landley.net>
parents:
diff changeset
47 elif "lsb" in reverse[i]: out='&lt;<a href="http://refspecs.linuxfoundation.org/LSB_4.1.0/LSB-Core-generic/LSB-Core-generic/%s.html">%s</a>&gt;' % (i,out)
cffb9b7f1c60 Add status.html and script to calculate it from roadmap info.
Rob Landley <rob@landley.net>
parents:
diff changeset
48 elif "development" in reverse[i]: out='(<a href="http://linux.die.net/man/1/%s">%s</a>)' % (i,out)
cffb9b7f1c60 Add status.html and script to calculate it from roadmap info.
Rob Landley <rob@landley.net>
parents:
diff changeset
49 elif "toolbox" in reverse[i]: out='{%s}' % out
805
0db28494d17d Accumulated web page changes. (Release announcement for previous release, roadmap updates, etc.)
Rob Landley <rob@landley.net>
parents: 757
diff changeset
50 elif "klibc_cmd" in reverse[i]: out='=%s=' % out
0db28494d17d Accumulated web page changes. (Release announcement for previous release, roadmap updates, etc.)
Rob Landley <rob@landley.net>
parents: 757
diff changeset
51 elif "sash_cmd" in reverse[i]: out='#%s#' % out
0db28494d17d Accumulated web page changes. (Release announcement for previous release, roadmap updates, etc.)
Rob Landley <rob@landley.net>
parents: 757
diff changeset
52 elif "sbase_cmd" in reverse[i]: out='@%s@' % out
0db28494d17d Accumulated web page changes. (Release announcement for previous release, roadmap updates, etc.)
Rob Landley <rob@landley.net>
parents: 757
diff changeset
53 elif "beastiebox_cmd" in reverse[i]: out='*%s*' % out
0db28494d17d Accumulated web page changes. (Release announcement for previous release, roadmap updates, etc.)
Rob Landley <rob@landley.net>
parents: 757
diff changeset
54 elif "request" in reverse[i]: out='+<a href="http://linux.die.net/man/1/%s">%s</a>+' % (i,out)
635
cffb9b7f1c60 Add status.html and script to calculate it from roadmap info.
Rob Landley <rob@landley.net>
parents:
diff changeset
55 elif "ready" in reverse[i]: pass
cffb9b7f1c60 Add status.html and script to calculate it from roadmap info.
Rob Landley <rob@landley.net>
parents:
diff changeset
56 else: sys.stderr.write("unknown %s %s\n" % (i, reverse[i]))
cffb9b7f1c60 Add status.html and script to calculate it from roadmap info.
Rob Landley <rob@landley.net>
parents:
diff changeset
57 if "ready" in reverse[i] or "pending" in reverse[i]:
639
3c591e7a367d More web page roadmap/status update stuff.
Rob Landley <rob@landley.net>
parents: 635
diff changeset
58 done.append(out)
635
cffb9b7f1c60 Add status.html and script to calculate it from roadmap info.
Rob Landley <rob@landley.net>
parents:
diff changeset
59 out='<strike>%s</strike>' % out
cffb9b7f1c60 Add status.html and script to calculate it from roadmap info.
Rob Landley <rob@landley.net>
parents:
diff changeset
60 else: pending.append(out)
cffb9b7f1c60 Add status.html and script to calculate it from roadmap info.
Rob Landley <rob@landley.net>
parents:
diff changeset
61
cffb9b7f1c60 Add status.html and script to calculate it from roadmap info.
Rob Landley <rob@landley.net>
parents:
diff changeset
62 outfile.write(out+"\n")
cffb9b7f1c60 Add status.html and script to calculate it from roadmap info.
Rob Landley <rob@landley.net>
parents:
diff changeset
63
805
0db28494d17d Accumulated web page changes. (Release announcement for previous release, roadmap updates, etc.)
Rob Landley <rob@landley.net>
parents: 757
diff changeset
64 print "done=%s" % len(done)
635
cffb9b7f1c60 Add status.html and script to calculate it from roadmap info.
Rob Landley <rob@landley.net>
parents:
diff changeset
65 outfile.write("</p></blockquote>\n")
cffb9b7f1c60 Add status.html and script to calculate it from roadmap info.
Rob Landley <rob@landley.net>
parents:
diff changeset
66
731
76e7bf56b2e6 Generate status page with new pubs.opengroup.org urls.
Rob Landley <rob@landley.net>
parents: 678
diff changeset
67 outfile.write("<a name=todo><h2><a href=#todo>TODO</a></h2><blockquote><p>%s</p></blockquote>\n" % "\n".join(pending))
76e7bf56b2e6 Generate status page with new pubs.opengroup.org urls.
Rob Landley <rob@landley.net>
parents: 678
diff changeset
68 outfile.write("<a name=done><h2><a href=#done>Done</a></h2><blockquote><p>%s</p></blockquote>\n" % "\n".join(done))