report: everything work again
This commit is contained in:
parent
7c640bee4c
commit
418de157e8
|
@ -25,15 +25,13 @@ def descr_content(path, prefix, descr, root=False):
|
|||
content.add(ListItem().join(Strong("path:"), Text(path)))
|
||||
content.add(ListItem().join(Strong("description:"), Text(descr.impl_get_information('doc'))))
|
||||
if not root:
|
||||
content.add(ListItem().join(Strong("container:"), Text(prefix)))
|
||||
# FIXME
|
||||
# if not root:
|
||||
# content.add(ListItem().join(Strong("type:"), Text(descr.group_type)))
|
||||
content.add(ListItem().join(Strong("parent config:"), Text(prefix)))
|
||||
if not root:
|
||||
content.add(ListItem().join(Strong("type:"), Text(descr._group_type)))
|
||||
if not root:
|
||||
content.add(ListItem().join(Strong("requirements:"), Text(str(descr._requires))))
|
||||
# FIXME
|
||||
# content.add(ListItem().join(Strong("is hidden:"), Text(str(descr._is_hidden()))))
|
||||
# content.add(ListItem().join(Strong("is disabled:"), Text(str(descr._is_disabled()))))
|
||||
if not root:
|
||||
content.add(ListItem().join(Strong("properties"), Text(str([prop for prop in descr._properties]))))
|
||||
content.add(Transition())
|
||||
content.add(Title(abovechar="", belowchar="-").join(Text("Ordered list of childrens for:"), Text(path)))
|
||||
names, options = descr._children
|
||||
|
@ -58,28 +56,22 @@ def opt_rst_content(path, prefix, descr, value):
|
|||
title.join(Text("Configuration's option overview for: "), Quote(descr._name))
|
||||
content.add(title)
|
||||
content.add(ListItem().join(Strong("name:"), Text(descr._name)))
|
||||
content.add(ListItem().join(Strong("value:"), Text(str(value))))
|
||||
content.add(ListItem().join(Strong("type:"), Text(descr.__class__.__name__)))
|
||||
content.add(ListItem().join(Strong("current value:"), Text(str(value))))
|
||||
content.add(ListItem().join(Strong("path:"), Text(path)))
|
||||
content.add(ListItem().join(Strong("container:"), Text(prefix)))
|
||||
# FIXME
|
||||
# if isinstance(descr, ChoiceOption):
|
||||
# content.add(ListItem().join(Strong("possible values:"), Text(str(descr.values))))
|
||||
content.add(ListItem().join(Strong("parent config:"), Text(prefix)))
|
||||
if isinstance(descr, ChoiceOption):
|
||||
content.add(ListItem().join(Strong("possible values:"), Text(str(descr._values))))
|
||||
if not isinstance(descr, SymLinkOption):
|
||||
# FIXME
|
||||
# content.add(ListItem().join(Strong("type:"), Text(str(descr.opt_type))))
|
||||
# content.add(ListItem().join(Strong("default:"), Text(str(descr.getdefault()))))
|
||||
content.add(ListItem().join(Strong("mime type:"), Text(str(descr._opt_type))))
|
||||
content.add(ListItem().join(Strong("default value:"), Text(str(descr.impl_getdefault()))))
|
||||
content.add(ListItem().join(Strong("description:"), Text(str(descr.impl_get_information('doc')))))
|
||||
content.add(ListItem().join(Strong("requirements:"), Text(str(descr._requires))))
|
||||
# FIXME
|
||||
# content.add(ListItem().join(Strong("is hidden:"), Text(str(descr._is_hidden()))))
|
||||
# content.add(ListItem().join(Strong("is disabled:"), Text(str(descr._is_disabled()))))
|
||||
# content.add(ListItem().join(Strong("is frozen:"), Text(str(descr._frozen))))
|
||||
# content.add(ListItem().join(Strong("is multi:"), Text(str(descr.multi))))
|
||||
# content.add(ListItem().join(Strong("is mandatory:"), Text(str(descr.is_mandatory()))))
|
||||
content.add(ListItem().join(Strong("properties"), Text(str([prop for prop in descr._properties]))))
|
||||
else:
|
||||
content.add(ListItem().join(Strong("links to:"), Text(str(descr.path))))
|
||||
content.add(Transition())
|
||||
content.add(Paragraph(Link("back to container", join(prefix + ".html"))))
|
||||
content.add(Paragraph(Link("back to parent config", join(prefix + ".html"))))
|
||||
make_rst_file(join(docdir, path + '.txt'), content)
|
||||
|
||||
def make_rest_overview(cfg, title=True):
|
||||
|
|
|
@ -1,115 +0,0 @@
|
|||
from tiramisu.config import Config
|
||||
from tiramisu import option
|
||||
# we shall keep extendable types out of the reach of unexceptional guys like us
|
||||
# horror __metaclass__ = extendabletype
|
||||
|
||||
def get_fullpath(opt, path):
|
||||
if path:
|
||||
return "%s.%s" % (path, opt._name)
|
||||
else:
|
||||
return opt._name
|
||||
|
||||
class Option:
|
||||
def make_rest_doc(self, path=""):
|
||||
fullpath = get_fullpath(self, path)
|
||||
result = Rest(
|
||||
Title(fullpath, abovechar="=", belowchar="="),
|
||||
ListItem(Strong("name:"), self._name),
|
||||
ListItem(Strong("description:"), self.doc))
|
||||
return result
|
||||
|
||||
class ChoiceOption(Option, option.ChoiceOption):
|
||||
def make_rest_doc(self, path=""):
|
||||
content = super(ChoiceOption, self).make_rest_doc(path)
|
||||
content.add(ListItem(Strong("option type:"), "choice option"))
|
||||
content.add(ListItem(Strong("possible values:"),
|
||||
*[ListItem(str(val)) for val in self.values]))
|
||||
if self.default is not None:
|
||||
content.add(ListItem(Strong("default:"), str(self.default)))
|
||||
|
||||
# requirements = []
|
||||
#
|
||||
# for val in self.values:
|
||||
# if val not in self._requires:
|
||||
# continue
|
||||
# req = self._requires[val]
|
||||
# requirements.append(ListItem("value '%s' requires:" % (val, ),
|
||||
# *[ListItem(Link(opt, opt + ".html"),
|
||||
# "to be set to '%s'" % (rval, ))
|
||||
# for (opt, rval) in req]))
|
||||
# if requirements:
|
||||
# content.add(ListItem(Strong("requirements:"), *requirements))
|
||||
return content
|
||||
|
||||
class BoolOption(Option, option.BoolOption):
|
||||
def make_rest_doc(self, path=""):
|
||||
content = super(BoolOption, self).make_rest_doc(path)
|
||||
fullpath = get_fullpath(self, path)
|
||||
content.add(ListItem(Strong("option type:"), "boolean option"))
|
||||
if self.default is not None:
|
||||
content.add(ListItem(Strong("default:"), str(self.default)))
|
||||
# if self._requires is not None:
|
||||
# requirements = [ListItem(Link(opt, opt + ".html"),
|
||||
# "must be set to '%s'" % (rval, ))
|
||||
# for (opt, rval) in self._requires]
|
||||
# if requirements:
|
||||
# content.add(ListItem(Strong("requirements:"), *requirements))
|
||||
return content
|
||||
|
||||
class IntOption(Option, option.IntOption):
|
||||
def make_rest_doc(self, path=""):
|
||||
content = super(IntOption, self).make_rest_doc(path)
|
||||
content.add(ListItem(Strong("option type:"), "integer option"))
|
||||
if self.default is not None:
|
||||
content.add(ListItem(Strong("default:"), str(self.default)))
|
||||
return content
|
||||
|
||||
class FloatOption(Option, option.FloatOption):
|
||||
def make_rest_doc(self, path=""):
|
||||
content = super(FloatOption, self).make_rest_doc(path)
|
||||
content.add(ListItem(Strong("option type:"), "float option"))
|
||||
if self.default is not None:
|
||||
content.add(ListItem(Strong("default:"), str(self.default)))
|
||||
return content
|
||||
|
||||
class StrOption(Option, option.StrOption):
|
||||
def make_rest_doc(self, path=""):
|
||||
content = super(StrOption, self).make_rest_doc(path)
|
||||
content.add(ListItem(Strong("option type:"), "string option"))
|
||||
if self.default is not None:
|
||||
content.add(ListItem(Strong("default:"), str(self.default)))
|
||||
return content
|
||||
|
||||
#class ArbitraryOption:
|
||||
# def make_rest_doc(self, path=""):
|
||||
# content = super(ArbitraryOption, self).make_rest_doc(path)
|
||||
# content.add(ListItem(Strong("option type:"),
|
||||
# "arbitrary option (mostly internal)"))
|
||||
# if self.default is not None:
|
||||
# content.add(ListItem(Strong("default:"), str(self.default)))
|
||||
# elif self.defaultfactory is not None:
|
||||
# content.add(ListItem(Strong("factory for the default value:"),
|
||||
# str(self.defaultfactory)))
|
||||
# return content
|
||||
|
||||
class OptionDescription(option.OptionDescription):
|
||||
def make_rest_doc(self, path=""):
|
||||
fullpath = get_fullpath(self, path)
|
||||
content = Rest(
|
||||
Title(fullpath, abovechar="=", belowchar="="))
|
||||
toctree = []
|
||||
for child in self._children:
|
||||
subpath = fullpath + "." + child._name
|
||||
toctree.append(subpath)
|
||||
content.add(Directive("toctree", *toctree, **{'maxdepth': 4}))
|
||||
content.join(
|
||||
ListItem(Strong("name:"), self._name),
|
||||
ListItem(Strong("description:"), self.doc))
|
||||
stack = []
|
||||
curr = content
|
||||
# config = Config(self)
|
||||
return content
|
||||
|
||||
# ____________________________________________________________
|
||||
|
||||
|
|
@ -2,8 +2,6 @@
|
|||
from tiramisu.config import *
|
||||
from tiramisu.option import *
|
||||
|
||||
all_modules = ['amon', 'sphynx', 'zephir']
|
||||
|
||||
gcoption = ChoiceOption('name', 'GC name', ('ref', 'framework'), 'ref')
|
||||
gcdummy = BoolOption('dummy', 'dummy', default=False)
|
||||
objspaceoption = ChoiceOption('objspace', 'Object space',
|
||||
|
|
|
@ -1,40 +0,0 @@
|
|||
# Copyright (C) 2012 Team tiramisu (see AUTHORS for all contributors)
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation; either version 2 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program; if not, write to the Free Software
|
||||
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
#
|
||||
# The original `Config` design model is unproudly borrowed from
|
||||
# the rough gus of pypy: pypy: http://codespeak.net/svn/pypy/dist/pypy/config/
|
||||
# the whole pypy projet is under MIT licence
|
||||
from tiramisu.config import Config
|
||||
from tiramisu.option import (OptionDescription, Option, ChoiceOption, BoolOption,
|
||||
FloatOption, StrOption, IntOption, IPOption, NetmaskOption,
|
||||
apply_requires)
|
||||
|
||||
# extendable type
|
||||
class extend(type):
|
||||
"""
|
||||
A magic trick for classes, which lets you add methods or attributes to a
|
||||
class
|
||||
"""
|
||||
def extend(cls, extclass):
|
||||
bases = list(extclass.__bases__)
|
||||
bases.append(extclass)
|
||||
for cl in bases:
|
||||
for key, value in cl.__dict__.items():
|
||||
if key == '__module__':
|
||||
continue
|
||||
setattr(cls, key, value)
|
||||
|
||||
# ____________________________________________________________
|
Loading…
Reference in New Issue