Skip to content

Commit 1c4a94c

Browse files
committed
FIX: Old Sphinx
1 parent eae4259 commit 1c4a94c

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

numpydoc/numpydoc.py

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@
2828
import sphinx
2929
from sphinx.addnodes import pending_xref, desc_content
3030
from sphinx.util import logging
31+
from sphinx.errors import ExtensionError
3132

3233
if sphinx.__version__ < '1.6.5':
3334
raise RuntimeError("Sphinx 1.6.5 or newer is required")
@@ -218,7 +219,13 @@ def setup(app, get_doc_object_=get_doc_object):
218219

219220
app.setup_extension('sphinx.ext.autosummary')
220221

221-
app.connect('config-inited', update_config)
222+
# Once we bump our Sphinx requirement higher (1.7 or 1.8?)
223+
# we can just connect to config-inited
224+
try:
225+
app.connect('config-inited', update_config)
226+
except ExtensionError:
227+
app.connect('builder-inited', update_config)
228+
222229
app.connect('autodoc-process-docstring', mangle_docstrings)
223230
app.connect('autodoc-process-signature', mangle_signature)
224231
app.connect('doctree-read', relabel_references)
@@ -246,7 +253,7 @@ def setup(app, get_doc_object_=get_doc_object):
246253

247254
def update_config(app, config=None):
248255
"""Update the configuration with default values."""
249-
if config is None: # only really needed for testing
256+
if config is None: # needed for testing and old Sphinx
250257
config = app.config
251258
# Do not simply overwrite the `app.config.numpydoc_xref_aliases`
252259
# otherwise the next sphinx-build will compare the incoming values (without

0 commit comments

Comments
 (0)