Skip to content

Commit 2ee2503

Browse files
[3.11] GH-104284: Fix documentation gettext build (GH-104296) (#104299)
Co-authored-by: Adam Turner <9087854+AA-Turner@users.noreply.github.com>
1 parent 8a6ff59 commit 2ee2503

File tree

1 file changed

+10
-10
lines changed

1 file changed

+10
-10
lines changed

Doc/tools/extensions/pyspecific.py

+10-10
Original file line numberDiff line numberDiff line change
@@ -679,7 +679,14 @@ def process_audit_events(app, doctree, fromdocname):
679679
node.replace_self(table)
680680

681681

682-
def patch_pairindextypes(app) -> None:
682+
def patch_pairindextypes(app, _env) -> None:
683+
"""Remove all entries from ``pairindextypes`` before writing POT files.
684+
685+
We want to run this just before writing output files, as the check to
686+
circumvent is in ``I18nBuilder.write_doc()``.
687+
As such, we link this to ``env-check-consistency``, even though it has
688+
nothing to do with the environment consistency check.
689+
"""
683690
if app.builder.name != 'gettext':
684691
return
685692

@@ -693,14 +700,7 @@ def patch_pairindextypes(app) -> None:
693700
# the Sphinx-translated pairindextypes values. As we intend to move
694701
# away from this, we need Sphinx to believe that these values don't
695702
# exist, by deleting them when using the gettext builder.
696-
697-
pairindextypes.pop('module', None)
698-
pairindextypes.pop('keyword', None)
699-
pairindextypes.pop('operator', None)
700-
pairindextypes.pop('object', None)
701-
pairindextypes.pop('exception', None)
702-
pairindextypes.pop('statement', None)
703-
pairindextypes.pop('builtin', None)
703+
pairindextypes.clear()
704704

705705

706706
def setup(app):
@@ -725,7 +725,7 @@ def setup(app):
725725
app.add_directive_to_domain('py', 'awaitablemethod', PyAwaitableMethod)
726726
app.add_directive_to_domain('py', 'abstractmethod', PyAbstractMethod)
727727
app.add_directive('miscnews', MiscNews)
728-
app.connect('builder-inited', patch_pairindextypes)
728+
app.connect('env-check-consistency', patch_pairindextypes)
729729
app.connect('doctree-resolved', process_audit_events)
730730
app.connect('env-merge-info', audit_events_merge)
731731
app.connect('env-purge-doc', audit_events_purge)

0 commit comments

Comments
 (0)