Skip to content
Merged
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
64 changes: 36 additions & 28 deletions docs/make_docs.py
Original file line number Diff line number Diff line change
Expand Up @@ -435,6 +435,9 @@ def run(self):
env=sphinx_env,
stdout=sys.stdout,
stderr=sys.stderr)
print(
f"Sphinx docs are generated at {(Path(build_dir)/'index.html').as_uri()}"
)


class DoxygenDocsBuilder:
Expand All @@ -449,9 +452,13 @@ def run(self):
cmd = ["doxygen", "Doxyfile"]
print('Calling: "%s"' % " ".join(cmd))
subprocess.check_call(cmd, stdout=sys.stdout, stderr=sys.stderr)
output_path = os.path.join(self.html_output_dir, "html", "cpp_api")
shutil.copytree(
os.path.join("doxygen", "html"),
os.path.join(self.html_output_dir, "html", "cpp_api"),
output_path,
)
print(
f"Doxygen docs are generated at {(Path(output_path)/'index.html').as_uri()}"
)

if os.path.exists(doxygen_temp_dir):
Expand Down Expand Up @@ -659,36 +666,37 @@ def run(self):
shutil.rmtree(cpp_build_dir)
print("Removed directory %s" % cpp_build_dir)

# Python API reST docs
if not args.py_api_rst == "never":
print("Building Python API reST")
pd = PyAPIDocsBuilder()
pd.generate_rst()

# Python example reST docs
py_example_input_dir = os.path.join(pwd, "..", "examples", "python")
if not args.py_example_rst == "never":
print("Building Python example reST")
pe = PyExampleDocsBuilder(input_dir=py_example_input_dir, pwd=pwd)
pe.generate_rst()

# Jupyter docs (needs execution)
if not args.execute_notebooks == "never":
print("Building Jupyter docs")
jdb = JupyterDocsBuilder(pwd, args.clean_notebooks,
args.execute_notebooks)
jdb.run()

# Remove *.ipynb in the output folder for CI docs.
if args.delete_notebooks:
print(f"Deleting all *.ipynb files in the {html_output_dir} folder.")
for f in Path(html_output_dir).glob("**/*.ipynb"):
print(f"Deleting {f}")
f.unlink()

# Sphinx is hard-coded to build with the "html" option
# To customize build, run sphinx-build manually
if args.sphinx:
# Python API reST docs
if not args.py_api_rst == "never":
print("Building Python API reST")
pd = PyAPIDocsBuilder()
pd.generate_rst()

# Python example reST docs
py_example_input_dir = os.path.join(pwd, "..", "examples", "python")
if not args.py_example_rst == "never":
print("Building Python example reST")
pe = PyExampleDocsBuilder(input_dir=py_example_input_dir, pwd=pwd)
pe.generate_rst()

# Jupyter docs (needs execution)
if not args.execute_notebooks == "never":
print("Building Jupyter docs")
jdb = JupyterDocsBuilder(pwd, args.clean_notebooks,
args.execute_notebooks)
jdb.run()

# Remove *.ipynb in the output folder for CI docs.
if args.delete_notebooks:
print(
f"Deleting all *.ipynb files in the {html_output_dir} folder.")
for f in Path(html_output_dir).glob("**/*.ipynb"):
print(f"Deleting {f}")
f.unlink()

print("Building Sphinx docs")
skip_notebooks = (args.execute_notebooks == "never" and
args.clean_notebooks)
Expand Down