Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bpo-40742: Doc: fix parallel build. #21237

Merged
merged 3 commits into from
Jul 6, 2020
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Doc: Purge audit event table as documents gets removed (or freshly re…
…ad).
  • Loading branch information
JulienPalard committed Jun 30, 2020
commit a9709dd8bf601dc325420313b39a7e3771464e97
18 changes: 17 additions & 1 deletion Doc/tools/extensions/pyspecific.py
Original file line number Diff line number Diff line change
Expand Up @@ -125,12 +125,27 @@ def run(self):

# Support for documenting audit event

def audit_events_purge(app, env, docname):
"""This is to remove from env.all_audit_events old traces of removed
documents.
"""
if not hasattr(env, 'all_audit_events'):
return
fresh_all_audit_events = {}
for name, event in env.all_audit_events:
event["source"] = [(d, t) for d, t in event["source"] if d != docname]
if event["source"]:
# Only keep audit_events that have at least one source.
fresh_all_audit_events[name] = event
env.all_audit_events = fresh_all_audit_events


def audit_events_merge(app, env, docnames, other):
"""In Sphinx parallel builds, this merges env.all_audit_events from
subprocesses.

all_audit_events is a dict of names, with values like:
{'source': [...], 'args': args}
{'source': [(docname, target), ...], 'args': args}
"""
if not hasattr(other, 'all_audit_events'):
return
Expand Down Expand Up @@ -608,4 +623,5 @@ def setup(app):
app.add_directive('miscnews', MiscNews)
app.connect('doctree-resolved', process_audit_events)
app.connect('env-merge-info', audit_events_merge)
app.connect('env-purge-doc', audit_events_purge)
return {'version': '1.0', 'parallel_read_safe': True}