| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
|
| 8 |
|
| 9 |
|
| 10 |
|
| 11 |
|
| 12 |
|
| 13 |
|
| 14 |
|
| 15 |
|
| 16 |
|
| 17 |
""" |
| 18 |
Doc Tasks |
| 19 |
~~~~~~~~~ |
| 20 |
|
| 21 |
""" |
| 22 |
|
| 23 |
import os as _os |
| 24 |
|
| 25 |
|
| 26 |
def run(ctx, build, source, target): |
| 27 |
""" |
| 28 |
Run sphinx |
| 29 |
|
| 30 |
Parameters: |
| 31 |
build (str): |
| 32 |
Build directory |
| 33 |
|
| 34 |
source (str): |
| 35 |
Source directory |
| 36 |
|
| 37 |
target (str): |
| 38 |
Target directory |
| 39 |
""" |
| 40 |
want_apidoc = ctx.doc.sphinx.want_apidoc |
| 41 |
if want_apidoc: |
| 42 |
apidoc = ctx.which("sphinx-apidoc") |
| 43 |
sphinx = ctx.which("sphinx-build") |
| 44 |
|
| 45 |
with ctx.shell.root_dir(): |
| 46 |
if want_apidoc: |
| 47 |
cmd = ( |
| 48 |
[apidoc] |
| 49 |
+ ctx.s("-f --private -stxt -e -o") |
| 50 |
+ ["%s/apidoc" % (source,), ctx.package] |
| 51 |
) |
| 52 |
ctx.run( |
| 53 |
ctx.c(cmd), |
| 54 |
env=dict( |
| 55 |
_os.environ, |
| 56 |
SPHINX_APIDOC_OPTIONS=",".join( |
| 57 |
["members", "undoc-members", "special-members"] |
| 58 |
), |
| 59 |
), |
| 60 |
echo=True, |
| 61 |
) |
| 62 |
|
| 63 |
cmd = ( |
| 64 |
[sphinx] |
| 65 |
+ ctx.s("-a -d") |
| 66 |
+ [_os.path.join(build, "doctrees")] |
| 67 |
+ ctx.s("-b html") |
| 68 |
+ [source, target] |
| 69 |
) |
| 70 |
ctx.run(ctx.c(cmd), echo=True) |