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

Improve support for deprecated builders without env arg #10702

Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
3 changes: 2 additions & 1 deletion sphinx/builders/__init__.py
Expand Up @@ -89,10 +89,11 @@ def __init__(self, app: "Sphinx", env: BuildEnvironment = None) -> None:
self.env: BuildEnvironment = env
self.env.set_versioning_method(self.versioning_method,
self.versioning_compare)
elif env is not Ellipsis:
else:
# ... is passed by SphinxComponentRegistry.create_builder to not show two warnings.
warnings.warn("The 'env' argument to Builder will be required from Sphinx 7.",
RemovedInSphinx70Warning, stacklevel=2)
self.env = Optional[BuildEnvironment] # type: ignore[assignment]
AA-Turner marked this conversation as resolved.
Show resolved Hide resolved
self.events: EventManager = app.events
self.config: Config = app.config
self.tags: Tags = app.tags
Expand Down
2 changes: 1 addition & 1 deletion sphinx/registry.py
Expand Up @@ -166,7 +166,7 @@ def create_builder(self, app: "Sphinx", name: str,
f"'env'argument. Report this bug to the developers of your custom builder, "
f"this is likely not a issue with Sphinx. The 'env' argument will be required "
f"from Sphinx 7.", RemovedInSphinx70Warning, stacklevel=2)
builder = self.builders[name](app, env=...) # type: ignore[arg-type]
builder = self.builders[name](app)
if env is not None:
builder.set_environment(env)
return builder
Expand Down