Source

pygame / makeref.py

Diff from to

makeref.py

     return files
 
 def Run():
+    
+    from optparse import OptionParser    
+    parser = OptionParser()
+    parser.add_option("", "--no-code-docs", dest="have_code_docs",
+                      action="store_false", default=True,
+                      help="No python documentation in code.")
+    (options, args) = parser.parse_args()
+
     files = collect_doc_files()
     for file in files:
         # print file
     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)
+        WriteDocHeader(outFile, doc, options.have_code_docs)
 
 
     outFile.write("\n\n/* Docs in a comments... slightly easier to read. */\n\n\n/*")
 
 
 
-def WriteDocHeader(f, doc):
+def WriteDocHeader(f, doc, have_code_docs ):
     name = doc.fullname.replace(".", "")
     name = name.replace("_", "")
     name = name.upper()
     defineName = "DOC_" + name
     text = ""
-    if doc.protos:
-        text = "\\n".join(doc.protos)
-    if doc.descr:
-        if text:
-            text += "\\n"
-        text += doc.descr
+    if have_code_docs:
+        if doc.protos:
+            text = "\\n".join(doc.protos)
+        if doc.descr:
+            if text:
+                text += "\\n"
+            text += doc.descr
     
     f.write('#define %s "%s"\n\n' % (defineName, text))
 
     if doc.kids:
         for kid in doc.kids:
-            WriteDocHeader(f, kid)
+            WriteDocHeader(f, kid, have_code_docs)
 
 def WriteDocHeaderComments(f, doc):
     name = doc.fullname