[pypy-svn] r38896 - pypy/dist/pypy/doc/config

cfbolz at codespeak.net cfbolz at codespeak.net
Thu Feb 15 15:27:21 CET 2007


Author: cfbolz
Date: Thu Feb 15 15:27:19 2007
New Revision: 38896

Added:
   pypy/dist/pypy/doc/config/commandline.txt
Modified:
   pypy/dist/pypy/doc/config/confrest.py
Log:
add commandline option documentation


Added: pypy/dist/pypy/doc/config/commandline.txt
==============================================================================

Modified: pypy/dist/pypy/doc/config/confrest.py
==============================================================================
--- pypy/dist/pypy/doc/config/confrest.py	(original)
+++ pypy/dist/pypy/doc/config/confrest.py	Thu Feb 15 15:27:19 2007
@@ -1,5 +1,5 @@
 from pypy.doc.confrest import *
-import pypy.config.makerestdoc
+from pypy.config.makerestdoc import make_cmdline_overview
 from pypy.config.config import Config
 from pypy.config import pypyoption, translationoption
 
@@ -29,10 +29,20 @@
     Page = PyPyPage 
 
     def get_content(self, txtpath, encoding):
+        if txtpath.basename == "commandline.txt":
+            result = [".. contents::"]
+            for descr in all_optiondescrs:
+                result.append(".. %s_:\n" % (descr._name, ))
+                result.append(make_cmdline_overview(descr).text())
+                result.append("")
+            result.append(txtpath.read())
+            return "\n".join(result)
         fullpath = txtpath.purebasename
         start = fullpath.split(".")[0]
         path = fullpath.rsplit(".", 1)[0]
-        basedescr = start_to_descr[start]
+        basedescr = start_to_descr.get(start)
+        if basedescr is None:
+            return txtpath.read()
         if fullpath.count(".") == 0:
             descr = basedescr
             path = ""
@@ -42,8 +52,10 @@
                     fullpath.split(".", 1)[1])
             descr = getattr(subconf._cfgimpl_descr, step)
         text = unicode(descr.make_rest_doc(path).text())
-        text += "\nDescription\n==========="
         if txtpath.check(file=True):
-            return u"%s\n\n%s" % (text, unicode(txtpath.read(), encoding))
+            content = txtpath.read()
+            if content:
+                text += "\nDescription\n==========="
+                return u"%s\n\n%s" % (text, unicode(txtpath.read(), encoding))
         return text
 



More information about the Pypy-commit mailing list