From b973de2f48f086c98ef8f3c13715f8392d30cafa Mon Sep 17 00:00:00 2001 From: Amar Takhar Date: Fri, 27 Feb 2015 11:14:36 -0500 Subject: Re-add docs.py for automatic documentation generation. This is a very quick hack to list all available options in RTEMS. It is not a permanent solution. --- rtems_waf/docs.py | 129 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 129 insertions(+) create mode 100644 rtems_waf/docs.py diff --git a/rtems_waf/docs.py b/rtems_waf/docs.py new file mode 100644 index 0000000000..afa251035f --- /dev/null +++ b/rtems_waf/docs.py @@ -0,0 +1,129 @@ +from bsp import list_bsp +from rtems_waf.config.base import config_list + + +def header(): + return """ + + + + + List of RTEMS BSP Options + + + + + + + + +
+ """ + + +def footer(): + return """ +
+ + + """ + + +TABLE_START = """ + + +""" + +TABLE_END = """ +
OptionDefault ValueDescription
+""" + +TABLE_ROW =""" + + %s + %s + %s + +""" + +BSP_HEADING = """ +
+
+

%s

+""" + +TABLE_HEADING = """ +
+%s +""" + + +def rtems_cmd_docs(ctx): + fp = open(ctx.options.file_out, "w") + fp.write(header()) + + full = [] + for arch in list_bsp: + full.append(arch) + for bsp in list_bsp[arch]: + full.append("%s/%s" % (arch, bsp)) + + all = ["general", "host"] + sorted(full) + + def cfg_get(entry): + for config in config_list: + if config.name == entry: + return config +# raise Exception("Not found %s" % entry) # XXX: Because not all BSPs are added. + + for entry in all: + cfg = cfg_get(entry) + + if cfg == None: + continue # XXX: Hack because not all BSPs are added. +# print cfg.name, cfg + + c = cfg() + + fp.write(BSP_HEADING % c.name) + def print_opt(name, values): + if not list(values): + return + + fp.write(TABLE_HEADING % "%s Options" % name) + fp.write(TABLE_START) + for option in values: + opt = values[option] + if type(opt.value) is list: + value = " ".join(opt.value) + else: + value = opt.value + fp.write(TABLE_ROW % (opt.name, value or " ", opt.descr)) + + fp.write(TABLE_END) + + print_opt("Build", c.option_build) + print_opt("Header", c.option_header) + + + fp.write(footer()) + -- cgit v1.2.3