Skip to content

Commit 1e2b443

Browse files
GaelVaroquauxTomDLT
authored andcommitted
MAINT/DOC: pngmath deprecated for sphinx >= 1.4 (scikit-learn#7279)
Fix scikit-learn#7222
1 parent 3250f15 commit 1e2b443

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

doc/conf.py

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,11 +32,20 @@
3232
# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom ones.
3333
extensions = [
3434
'sphinx.ext.autodoc', 'sphinx.ext.autosummary',
35-
'sphinx.ext.pngmath', 'numpy_ext.numpydoc',
35+
'numpy_ext.numpydoc',
3636
'sphinx.ext.linkcode', 'sphinx.ext.doctest',
3737
'sphinx_gallery.gen_gallery',
3838
]
3939

40+
# pngmath / imgmath compatibility layer for different sphinx versions
41+
import sphinx
42+
from distutils.version import LooseVersion
43+
if LooseVersion(sphinx.__version__) < LooseVersion('1.4'):
44+
extensions.append('sphinx.ext.pngmath')
45+
else:
46+
extensions.append('sphinx.ext.imgmath')
47+
48+
4049
autodoc_default_flags = ['members', 'inherited-members']
4150

4251
# Add any paths that contain templates here, relative to this directory.

0 commit comments

Comments
 (0)