|
18 | 18 | """
|
19 | 19 | from __future__ import division, absolute_import, print_function
|
20 | 20 |
|
| 21 | +from copy import deepcopy |
21 | 22 | import sys
|
22 | 23 | import re
|
23 | 24 | import pydoc
|
@@ -160,7 +161,7 @@ def mangle_docstrings(app, what, name, obj, options, lines):
|
160 | 161 | 'attributes_as_param_list':
|
161 | 162 | app.config.numpydoc_attributes_as_param_list,
|
162 | 163 | 'xref_param_type': app.config.numpydoc_xref_param_type,
|
163 |
| - 'xref_aliases': app.config.numpydoc_xref_aliases, |
| 164 | + 'xref_aliases': app.config.numpydoc_xref_aliases_complete, |
164 | 165 | 'xref_ignore': app.config.numpydoc_xref_ignore,
|
165 | 166 | }
|
166 | 167 |
|
@@ -258,9 +259,15 @@ def setup(app, get_doc_object_=get_doc_object):
|
258 | 259 |
|
259 | 260 | def update_config(app):
|
260 | 261 | """Update the configuration with default values."""
|
| 262 | + # Do not simply overwrite the `app.config.numpydoc_xref_aliases` |
| 263 | + # otherwise the next sphinx-build will compare the incoming values (without |
| 264 | + # our additions) to the old values (with our additions) and trigger |
| 265 | + # a full rebuild! |
| 266 | + numpydoc_xref_aliases_complete = deepcopy(app.config.numpydoc_xref_aliases) |
261 | 267 | for key, value in DEFAULT_LINKS.items():
|
262 |
| - if key not in app.config.numpydoc_xref_aliases: |
263 |
| - app.config.numpydoc_xref_aliases[key] = value |
| 268 | + if key not in numpydoc_xref_aliases_complete: |
| 269 | + numpydoc_xref_aliases_complete[key] = value |
| 270 | + app.config.numpydoc_xref_aliases_complete = numpydoc_xref_aliases_complete |
264 | 271 |
|
265 | 272 |
|
266 | 273 | # ------------------------------------------------------------------------------
|
|
0 commit comments