4.115
Rev | Line | |
---|
[5daabd2] | 1 | import sys, os |
---|
| 2 | |
---|
| 3 | def cmd_configure(ctx): |
---|
| 4 | ctx.find_program("sphinx-build", var="SPHINX_BUILD") |
---|
| 5 | |
---|
| 6 | def cmd_build(ctx, sub, source_dir="."): |
---|
| 7 | srcnode = ctx.srcnode.abspath() |
---|
| 8 | |
---|
| 9 | file_conf = ctx.path.parent.find_node("common/conf.py") |
---|
| 10 | tg = ctx( |
---|
| 11 | features = "subst", |
---|
| 12 | source = file_conf, |
---|
| 13 | target = file_conf.name |
---|
| 14 | ) |
---|
| 15 | |
---|
| 16 | tg.__dict__.update(sub) |
---|
| 17 | |
---|
| 18 | |
---|
| 19 | # Copy resources. |
---|
| 20 | for dir in ["_static", "_templates"]: |
---|
| 21 | files = ctx.path.parent.find_node("common").ant_glob("%s/*" % dir) |
---|
| 22 | ctx.path.get_bld().make_node(dir).mkdir() # dirs |
---|
| 23 | |
---|
| 24 | ctx( |
---|
| 25 | features = "subst", |
---|
| 26 | is_copy = True, |
---|
| 27 | source = files, |
---|
| 28 | target = [ctx.bldnode.find_node(dir).get_bld().make_node(x.name) for x in files] |
---|
| 29 | ) |
---|
| 30 | |
---|
| 31 | ctx( |
---|
| 32 | rule = "${SPHINX_BUILD} -b html -c build -j %s -d build/doctrees %s build/html" % (ctx.options.jobs, source_dir), |
---|
| 33 | cwd = ctx.path.abspath(), |
---|
| 34 | source = ctx.path.ant_glob('**/*.rst') + ctx.path.ant_glob('conf.py'), |
---|
| 35 | target = ctx.path.find_or_declare('html/index.html') |
---|
| 36 | ) |
---|
| 37 | |
---|
Note: See
TracBrowser
for help on using the repository browser.