Skip to content

Commit 5254acc

Browse files
committed
Fix broken API reference not using proper interrogatedb information
1 parent 160e03b commit 5254acc

1 file changed

Lines changed: 26 additions & 0 deletions

File tree

conf.py

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,32 @@
3232
print("Skipping building the API reference.")
3333
build_api_reference = False
3434

35+
if build_api_reference:
36+
# The standalone panda3d-interrogate package ships its own (initially empty)
37+
# interrogate database, separate from the data compiled into the panda3d C++
38+
# modules. Unless we load Panda3D's interrogate data into it explicitly,
39+
# idb.has_module() returns False for every module and sphinx_interrogatedb
40+
# silently falls back to plain autodoc (which dumps the raw "C++ Interface:"
41+
# docstrings). Point it at the .in files shipped in pandac/input and load
42+
# them so the interrogatedb documenters can do their job.
43+
try:
44+
import glob
45+
import pandac
46+
input_dir = os.path.join(pandac.__path__[0], 'input')
47+
interrogate_add_search_directory(input_dir)
48+
for in_file in sorted(glob.glob(os.path.join(input_dir, '*.in'))):
49+
interrogate_request_database(os.path.basename(in_file))
50+
51+
if interrogate_number_of_global_types() == 0:
52+
print("Loaded no interrogate types from", input_dir)
53+
print("Skipping building the API reference.")
54+
build_api_reference = False
55+
except Exception as ex:
56+
print("Could not load the Panda3D interrogate database:")
57+
print(ex)
58+
print("Skipping building the API reference.")
59+
build_api_reference = False
60+
3561
# If extensions (or modules to document with autodoc) are in another directory,
3662
# add these directories to sys.path here. If the directory is relative to the
3763
# documentation root, use os.path.abspath to make it absolute, like shown here.

0 commit comments

Comments
 (0)