Make build_sphinx work on missing apidoc
of course in that case there will be no API doc
This commit is contained in:
parent
2bde308720
commit
838e7c9c86
1 changed files with 13 additions and 7 deletions
|
@ -13,10 +13,13 @@
|
|||
# All configuration values have a default; values that are commented out
|
||||
# serve to show the default.
|
||||
|
||||
from __future__ import print_function
|
||||
import sys
|
||||
import os
|
||||
import subprocess
|
||||
|
||||
from sphinx.util.console import red
|
||||
|
||||
# If extensions (or modules to document with autodoc) are in another directory,
|
||||
# add these directories to sys.path here. If the directory is relative to the
|
||||
# documentation root, use os.path.abspath to make it absolute, like shown here.
|
||||
|
@ -270,7 +273,6 @@ def run_apidoc(_):
|
|||
modules = ['larigira']
|
||||
exclude_files = [os.path.abspath(os.path.join(proj_dir, excl))
|
||||
for excl in ('larigira/rpc.py', 'larigira/dbadmin/')]
|
||||
for module in modules:
|
||||
output_path = os.path.join(cur_dir, 'api')
|
||||
cmd_path = 'sphinx-apidoc'
|
||||
if hasattr(sys, 'real_prefix'): # Are we in a virtualenv?
|
||||
|
@ -278,6 +280,10 @@ def run_apidoc(_):
|
|||
cmd_path = os.path.abspath(os.path.join(sys.prefix,
|
||||
'bin',
|
||||
'sphinx-apidoc'))
|
||||
if not os.path.exists(cmd_path):
|
||||
print(red("No apidoc available!"), file=sys.stderr)
|
||||
return
|
||||
for module in modules:
|
||||
subprocess.check_call([cmd_path,
|
||||
'--force',
|
||||
'-o', output_path,
|
||||
|
|
Loading…
Reference in a new issue