diff options
author | Amar Takhar <amar@rtems.org> | 2016-01-15 23:41:06 -0500 |
---|---|---|
committer | Amar Takhar <verm@darkbeer.org> | 2016-05-02 20:51:07 -0400 |
commit | 5daabd23cfd13662e74ce8d069204882eb1fbad9 (patch) | |
tree | f4146d003923a3de5cf5071b76721b7883123364 /common/waf.py | |
download | rtems-docs-5daabd23cfd13662e74ce8d069204882eb1fbad9.tar.bz2 |
Initial reST documentation using Sphinx.
Diffstat (limited to 'common/waf.py')
-rw-r--r-- | common/waf.py | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/common/waf.py b/common/waf.py new file mode 100644 index 0000000..bd5243a --- /dev/null +++ b/common/waf.py @@ -0,0 +1,37 @@ +import sys, os + +def cmd_configure(ctx): + ctx.find_program("sphinx-build", var="SPHINX_BUILD") + +def cmd_build(ctx, sub, source_dir="."): + srcnode = ctx.srcnode.abspath() + + file_conf = ctx.path.parent.find_node("common/conf.py") + tg = ctx( + features = "subst", + source = file_conf, + target = file_conf.name + ) + + tg.__dict__.update(sub) + + + # Copy resources. + for dir in ["_static", "_templates"]: + files = ctx.path.parent.find_node("common").ant_glob("%s/*" % dir) + ctx.path.get_bld().make_node(dir).mkdir() # dirs + + ctx( + features = "subst", + is_copy = True, + source = files, + target = [ctx.bldnode.find_node(dir).get_bld().make_node(x.name) for x in files] + ) + + ctx( + rule = "${SPHINX_BUILD} -b html -c build -j %s -d build/doctrees %s build/html" % (ctx.options.jobs, source_dir), + cwd = ctx.path.abspath(), + source = ctx.path.ant_glob('**/*.rst') + ctx.path.ant_glob('conf.py'), + target = ctx.path.find_or_declare('html/index.html') + ) + |