changeset 22:b5481d0c89c1

Teach docdiridx to traverse Documentation itself, without "find".
author Rob Landley <rob@landley.net>
date Fri, 10 Aug 2007 15:16:35 -0500
parents 8dc7c0651c06
children 68ec04c0508b
files make/docdiridx.py
diffstat 1 files changed, 5 insertions(+), 8 deletions(-) [+]
line wrap: on
line diff
--- a/make/docdiridx.py	Thu Aug 09 22:16:32 2007 -0500
+++ b/make/docdiridx.py	Fri Aug 10 15:16:35 2007 -0500
@@ -4,19 +4,16 @@
 
 import os,sys
 
-if len(sys.argv)==1:
-  print "Usage: docdiridx.py `find Documentation -name 00-INDEX`"
-  sys.exit(1)
+for dir in os.walk("Documentation"):
+  if not "00-INDEX" in dir[2]: continue
 
-for name in sys.argv[1:]:
   # Read input
 
-  name = "/".join(name.split("/")[:-1])
-  lines = open("%s/00-INDEX" % name).read()
+  lines = open("%s/00-INDEX" % dir[0]).read()
 
   # Open output, write header and <pre> section (if any)
-  out = open("%s/index.html" % name, "w")
-  out.write("<html>\n<title>%s</title>\n<body>\n<ul>\n" % name)
+  out = open("%s/index.html" % dir[0], "w")
+  out.write("<html>\n<title>%s</title>\n<body>\n<ul>\n" % dir[0])
   lines = lines.split("00-INDEX",1)
   if lines[0]: out.write("<pre>%s</pre>\n" % lines[0])
   lines = lines[1].split("\n")