docs: restore exception handling in conf.py
Change-Id: Ie6408385e821e509e964bcea001a39f8cfdc5da0
This commit is contained in:
1 parent
6cc9541220
commit
36184f6893
1 file changed
+8
-5
+8
-5
@@ -35,12 +35,15 @@ extensions = [
|
||||
'sphinx.ext.todo',
|
||||
]
|
||||
|
||||
def addExtensionIfExists(extension):
|
||||
if importlib.util.find_spec(extension) is not None:
|
||||
extensions.append(extension)
|
||||
else:
|
||||
def addExtensionIfExists(extension: str):
|
||||
try:
|
||||
if importlib.util.find_spec(extension) is None:
|
||||
raise ModuleNotFoundError(extension)
|
||||
except (ImportError, ValueError):
|
||||
sys.stderr.write(f'WARNING: Extension {extension!r} not found. '
|
||||
'Some documentation may not build correctly.\n')
|
||||
'Some documentation may not build correctly.\n')
|
||||
else:
|
||||
extensions.append(extension)
|
||||
|
||||
addExtensionIfExists('sphinxcontrib.doxylink')
|
||||
|
||||
|
||||
Reference in new issue
Block a user