|
32 | 32 | print("Skipping building the API reference.") |
33 | 33 | build_api_reference = False |
34 | 34 |
|
| 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 | + |
35 | 61 | # If extensions (or modules to document with autodoc) are in another directory, |
36 | 62 | # add these directories to sys.path here. If the directory is relative to the |
37 | 63 | # documentation root, use os.path.abspath to make it absolute, like shown here. |
|
0 commit comments