-
-
Notifications
You must be signed in to change notification settings - Fork 2.1k
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
Improve support for deprecated builders without env arg #10702
Merged
AA-Turner
merged 5 commits into
sphinx-doc:5.1.x
from
jdknight:improve-support-for-deprecated-builders-without-env-arg
Jul 25, 2022
Merged
Improve support for deprecated builders without env arg #10702
AA-Turner
merged 5 commits into
sphinx-doc:5.1.x
from
jdknight:improve-support-for-deprecated-builders-without-env-arg
Jul 25, 2022
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Changes to the builder to move towards passing an environment into the builder [1] can cause some legacy builder types to fail to load [2]. For example: Traceback (most recent call last): File "/home/runner/work/confluencebuilder/confluencebuilder/.tox/py38-sphinx51/lib/python3.8/site-packages/sphinx/registry.py", line 162, in create_builder return self.builders[name](app, env) TypeError: __init__() takes 2 positional arguments but 3 were given The fallback case for preparing deprecated builders should avoid setting `env`. [1]: 6ef22d2 [2]: sphinx-contrib/confluencebuilder#691 Signed-off-by: James Knight <james.d.knight@live.com>
Builder implementation would originally always create an optional environment instance, which an extended builder's implementation could reference in their own `__init__` call. However, with the change [1] to support an `env` argument, there is no longer a guarantee that `self.env` will exist. This commit changes this to restore the creating of `self.env` if `env` if not passed in. [1]: 6ef22d2 Signed-off-by: James Knight <james.d.knight@live.com>
Thank you for the quick PR--this is annoying, I thought I'd handled all the cases. Can you confirm the PR works for sphinxcontrib confluence please? I plan to include in 5.1.1. A |
Here is a sanity check with various versions of Sphinx:
|
AA-Turner
reviewed
Jul 25, 2022
AA-Turner
reviewed
Jul 25, 2022
AA-Turner
reviewed
Jul 25, 2022
jdknight
deleted the
improve-support-for-deprecated-builders-without-env-arg
branch
July 26, 2022 00:12
This was referenced Jul 31, 2022
attakei
added a commit
to attakei/sphinx-revealjs
that referenced
this pull request
Aug 1, 2022
Initialize of builder classes support create_builder for Sphinx 5.x and later Refs: #123 Refs: sphinx-doc/sphinx#10702
attakei
added a commit
to attakei/sphinx-revealjs
that referenced
this pull request
Aug 1, 2022
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Feature or Bugfix
Purpose
After upgrading to Sphinx 5.1.x, some third-party builders may fail to load. For example:
It appears the
env
change (6ef22d2) for builders using the older cannot handle the new Sphinx engine.These changes help support the older environment initialization, for builders that have yet to upgrade their definitions.
Relates