remove hard dependency and configure spelling extension only if it can load enchant properly

This commit is contained in:
Axel Kohlmeyer
2020-07-03 11:26:43 -04:00
parent 735f9ad592
commit 1815ab610e

View File

@ -16,6 +16,13 @@
import sys import sys
import os import os
has_enchant = False
try:
import enchant
has_enchant = True
except:
pass
# If extensions (or modules to document with autodoc) are in another directory, # If extensions (or modules to document with autodoc) are in another directory,
# add these directories to sys.path here. If the directory is relative to the # add these directories to sys.path here. If the directory is relative to the
# documentation root, use os.path.abspath to make it absolute, like shown here. # documentation root, use os.path.abspath to make it absolute, like shown here.
@ -321,7 +328,7 @@ epub_author = 'The LAMMPS Developers'
# configure spelling extension if present # configure spelling extension if present
import importlib.util import importlib.util
spelling_spec = importlib.util.find_spec("sphinxcontrib.spelling") spelling_spec = importlib.util.find_spec("sphinxcontrib.spelling")
if spelling_spec: if spelling_spec and has_enchant:
extensions.append('sphinxcontrib.spelling') extensions.append('sphinxcontrib.spelling')
spelling_lang='en_US' spelling_lang='en_US'