Skip to content

Commit 35a9413

Browse files
committed
Prevent viewcode trying to import panda3d modules
1 parent f406ec0 commit 35a9413

1 file changed

Lines changed: 9 additions & 0 deletions

File tree

conf.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1075,6 +1075,12 @@ def generate_dot(self, name, urls={}, env=None,
10751075
return ''.join(res)
10761076

10771077

1078+
def on_viewcode_find_source(app, modname):
1079+
# Prevent viewcode importing panda3d.* modules.
1080+
if modname == 'panda3d' or modname.startswith('panda3d.'):
1081+
return '', {}
1082+
1083+
10781084
def setup(app):
10791085
from sphinx.ext.inheritance_diagram import InheritanceGraph
10801086
InheritanceGraph.generate_dot = generate_dot
@@ -1087,4 +1093,7 @@ def setup(app):
10871093

10881094
app.connect('missing-reference', on_missing_reference, priority=901)
10891095

1096+
if build_viewcode:
1097+
app.connect('viewcode-find-source', on_viewcode_find_source)
1098+
10901099
app.add_autodocumenter(ExcludeDocumenter)

0 commit comments

Comments
 (0)