[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

[pygame] PATCH makeref.py



Hello


yesterday I wanted to make the new documentation for the SVN pygame and found that the makeref.py does not work under windows. I found out that it is because the paths where hardcoded like this "src/pygame.doc" instead of using os.path.join("src", "pygame.doc"). Is there a reason to not use os.path.join() ? If not I have added the patch to change all paths to use os.path.join()


~DR0ID
Index: makeref.py
===================================================================
--- makeref.py	(revision 1026)
+++ makeref.py	(working copy)
@@ -19,14 +19,16 @@
 
 def Run():
     # get files and shuffle ordering
-    files = glob.glob('src/*.doc') + glob.glob('lib/*.doc')
-    files.remove("src/pygame.doc")
+    files = glob.glob(os.path.join('src','*.doc')) + glob.glob(os.path.join('lib','*.doc'))
+    for file in files:
+        print file
+    files.remove(os.path.join("src","pygame.doc"))
 
     #XXX: sort(key=) is only available in >= python2.4
     #files.sort(key=sortkey)
     files = sort_list_by_keyfunc(files, sortkey)
 
-    files.insert(0, "src/pygame.doc")
+    files.insert(0, os.path.join("src","pygame.doc"))
     docs = []
     pages = []
     for f in files:
@@ -47,7 +49,7 @@
         MakeIndex(name, doc, index)
     
     for name, doc in docs:
-        fullname = "docs/ref/%s.html" % name
+        fullname = os.path.join("docs","ref","%s.html") % name
         outFile = open(fullname, "w")
         outFile.write(HTMLHeader % name)
         WritePageLinks(outFile, pages)
@@ -56,14 +58,14 @@
         outFile.write(HTMLFinish)
         outFile.close()
  
-    outFile = open("src/pygamedocs.h", "w")
+    outFile = open(os.path.join("src","pygamedocs.h"), "w")
     outFile.write("/* Auto generated file: with makeref.py .  Docs go in src/ *.doc . */\n")
     for doc in justDocs:
         WriteDocHeader(outFile, doc)
 
     topDoc = LayoutDocs(justDocs)
 
-    outFile = open("docs/ref/index.html", "w")
+    outFile = open(os.path.join("docs","ref","index.html"), "w")
     outFile.write(HTMLHeader % "Index")
     WritePageLinks(outFile, pages)
     outFile.write(HTMLMid)