Import status_iterator from sphinx.util.display with fallback to sphinx.util
for backward compatibility.
The status_iterator function was moved from sphinx.util to sphinx.util.display
in Sphinx 6.1 and the old import path was removed in Sphinx 8.0. See
https://www.sphinx-doc.org/en/master/extdev/deprecated.html. Since our CI
and packaging environments use older Sphinx versions (Ubuntu Jammy ships 4.3.2,
CentOS ships 3.4.3), we need to maintain compatibility with both old and new
Sphinx versions.
This change ensures the documentation builds successfully across all supported
Sphinx versions by attempting the new import path first, then falling back to
the legacy path if needed.
Signed-off-by: Kefu Chai <tchaikov@gmail.com>
from sphinx import addnodes
from sphinx.directives import ObjectDescription
from sphinx.locale import _
-from sphinx.util import logging, status_iterator, ws_re
+from sphinx.util import logging, ws_re
+try:
+ from sphinx.util.display import status_iterator
+except ImportError:
+ from sphinx.util import status_iterator
from sphinx.util.docutils import switch_source_input, SphinxDirective
from sphinx.util.docfields import Field
from sphinx.util.nodes import make_id