docs: restore exception handling in conf.py
Change-Id: I3f114ad2934e84fb664a63e0dd0ad1641569c721
This commit is contained in:
+8
-5
@@ -35,12 +35,15 @@ extensions = [
|
|||||||
'sphinx.ext.todo',
|
'sphinx.ext.todo',
|
||||||
]
|
]
|
||||||
|
|
||||||
def addExtensionIfExists(extension):
|
def addExtensionIfExists(extension: str):
|
||||||
if importlib.util.find_spec(extension) is not None:
|
try:
|
||||||
extensions.append(extension)
|
if importlib.util.find_spec(extension) is None:
|
||||||
else:
|
raise ModuleNotFoundError(extension)
|
||||||
|
except (ImportError, ValueError):
|
||||||
sys.stderr.write(f'WARNING: Extension {extension!r} not found. '
|
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')
|
addExtensionIfExists('sphinxcontrib.doxylink')
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user