-
Notifications
You must be signed in to change notification settings - Fork 71
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
🔧 Consolidate needs data post-processing #1039
Conversation
#1036 got accepted and is ready for merge. After that I review this PR :) |
5975f2f
to
a27b71b
Compare
create_back_links(env, links["option"]) | ||
|
||
process_constraints(app) | ||
if not needs_data.needs_is_post_processed: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is the main change; we move all needs post-processing under a single if
block, which only gets run once (not for every document)
# We call process_needextend here by our own, so that we are able | ||
# to give print_need_nodes the already found need_nodes. | ||
process_needextend(app, doctree, fromdocname) | ||
for extend_node in doctree.findall(Needextend): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is split out from the original process_needextend
function, since it is not part of the needs data post-processing
check_links(env) | ||
create_back_links(env) | ||
process_constraints(app) | ||
extend_needs_data(app) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is process_needextend
, but with the removal of nodes
resolve_dynamic_values(env) | ||
resolve_variants_options(env) | ||
check_links(env) | ||
create_back_links(env) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
looping through all link types is also moved internal to the create_back_links
function
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for cleaning this up a little bit.
Looks good to me.
This commit is a step towards being able to generate the needs.json without running the Sphinx `BUILD` phase. Here we consolidate all functions that post-process the needs data, after it has been fully extracted from all documents and external sources. We remove the individual logic from within these functions, to check if the post-processing has already been done, and instead check before running all the functions. This refactor does not actually change the sphinx-needs process in any way, this will come later.
This PR is a step towards #1018, and being able to generate the
needs.json
without running the SphinxBUILD
phase.Here we consolidate all functions that post-process the needs data, after it has been fully extracted from all documents and external sources.
We remove the individual logic from within these functions, to check if the post-processing has already been done, and instead check before running all the functions.
This refactor does not actually change the sphinx-needs process in any way, this will come in later PRs