[pypy-svn] r38814 - in pypy/dist/pypy/config: . test
cfbolz at codespeak.net
cfbolz at codespeak.net
Wed Feb 14 13:27:49 CET 2007
Author: cfbolz
Date: Wed Feb 14 13:27:47 2007
New Revision: 38814
Modified:
pypy/dist/pypy/config/makerestdoc.py
pypy/dist/pypy/config/test/test_makerestdoc.py
Log:
add the doc lines into the tree
Modified: pypy/dist/pypy/config/makerestdoc.py
==============================================================================
--- pypy/dist/pypy/config/makerestdoc.py (original)
+++ pypy/dist/pypy/config/makerestdoc.py Wed Feb 14 13:27:47 2007
@@ -1,6 +1,6 @@
import py
from py.__.rest.rst import Rest, Paragraph, Strong, ListItem, Title, Link
-from py.__.rest.rst import Directive
+from py.__.rest.rst import Directive, Em
from pypy.config.config import ChoiceOption, BoolOption, StrOption, IntOption
from pypy.config.config import FloatOption, OptionDescription, Option, Config
@@ -140,13 +140,20 @@
stack = []
prefix = fullpath
curr = content
- for subpath in self.getpaths(include_groups=True):
- subpath = fullpath + "." + subpath
+ config = Config(self)
+ for ending in self.getpaths(include_groups=True):
+ subpath = fullpath + "." + ending
while not (subpath.startswith(prefix) and
subpath[len(prefix)] == "."):
curr, prefix = stack.pop()
- print subpath, fullpath, curr
- new = curr.add(ListItem(Link(subpath, subpath + ".html")))
+ print subpath, fullpath, ending, curr
+ sub, step = config._cfgimpl_get_home_by_path(ending)
+ doc = getattr(sub._cfgimpl_descr, step).doc
+ if doc:
+ new = curr.add(ListItem(Link(subpath + ":", subpath + ".html"),
+ Em(doc)))
+ else:
+ new = curr.add(ListItem(Link(subpath + ":", subpath + ".html")))
stack.append((curr, prefix))
prefix = subpath
curr = new
Modified: pypy/dist/pypy/config/test/test_makerestdoc.py
==============================================================================
--- pypy/dist/pypy/config/test/test_makerestdoc.py (original)
+++ pypy/dist/pypy/config/test/test_makerestdoc.py Wed Feb 14 13:27:47 2007
@@ -14,14 +14,16 @@
def generate_html(descr):
config = Config(descr)
txt = descr.make_rest_doc().text()
- checkrest(txt, descr._name + ".txt")
+
+ result = {"": checkrest(txt, descr._name + ".txt")}
for path in config.getpaths(include_groups=True):
subconf, step = config._cfgimpl_get_home_by_path(path)
fullpath = (descr._name + "." + path)
prefix = fullpath.rsplit(".", 1)[0]
txt = getattr(subconf._cfgimpl_descr, step).make_rest_doc(
prefix).text()
- checkrest(txt, fullpath + ".txt")
+ result[path] = checkrest(txt, fullpath + ".txt")
+ return result
def test_simple():
descr = OptionDescription("foo", "doc", [
@@ -60,6 +62,8 @@
requires=[("a0.bar", "c"), ("a0.B2", True)]),
ChoiceOption("bar", "more doc", ["a", "b", "c"],
default="a")])
- generate_html(descr)
+ result = generate_html(descr)
+ assert "more doc" in result[""]
+
More information about the Pypy-commit
mailing list