[pypy-svn] r39005 - pypy/dist/pypy/doc

mwh at codespeak.net mwh at codespeak.net
Fri Feb 16 14:11:21 CET 2007


Author: mwh
Date: Fri Feb 16 14:11:15 2007
New Revision: 39005

Modified:
   pypy/dist/pypy/doc/conftest.py
Log:
make the text for the link produced :config:`some option` be --some-option, not
some.option (if that made any sense).


Modified: pypy/dist/pypy/doc/conftest.py
==============================================================================
--- pypy/dist/pypy/doc/conftest.py	(original)
+++ pypy/dist/pypy/doc/conftest.py	Fri Feb 16 14:11:15 2007
@@ -54,6 +54,8 @@
     def config_role(name, rawtext, text, lineno, inliner, options={},
                     content=[]):
         from docutils import nodes
+        from pypy.config.pypyoption import get_pypy_config
+        from pypy.config.makerestdoc import get_cmdline
         txt = thisdir.join("config", text + ".txt")
         html = thisdir.join("config", text + ".html")
         assert txt.check()
@@ -67,6 +69,17 @@
                 break
             curr = curr.dirpath()
             prefix += "../"
+        config = get_pypy_config()
+        # begin horror
+        h, n = config._cfgimpl_get_home_by_path('objspace.std.withmethodcache');
+        opt = getattr(h._cfgimpl_descr, n)
+        # end horror
+        cmdline = get_cmdline(opt.cmdline, text)
+        shortest_long_option = 'X'*1000
+        for cmd in cmdline.split():
+            if cmd.startswith('--') and len(cmd) < len(shortest_long_option):
+                shortest_long_option = cmd
+        text = shortest_long_option
         target = prefix + relative
         print text, target
         reference_node = nodes.reference(rawtext, text, name=text, refuri=target)



More information about the Pypy-commit mailing list