Skip to content

refactor: make bzlmod create host repos for toolchains #2888

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

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

rickeylev
Copy link
Collaborator

@rickeylev rickeylev commented May 16, 2025

This moves the creation of the host_toolchain repos into the bzlmod phase.

This is to facilitate future work to allow for when a a particular version
doesn't provide a host-compatible variant

DO NOT MERGE:

Work towards #2081

@rickeylev rickeylev force-pushed the refactor.bzlmod.creates.host.repos branch from 1e70b1e to 47b115e Compare May 17, 2025 18:15
Copy link
Collaborator

@aignas aignas left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, I like the host_compatible solution you did here a lot!

name = toolchain_info.name,
_internal_bzlmod_toolchain_call = True,
**kwargs
)
loaded_platforms[full_python_version] = toolchain_registered_platforms
host_compatible = []
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice!

@@ -375,6 +375,8 @@ def _host_toolchain_impl(rctx):
if not rctx.delete(python_tester):
fail("Failed to delete the python tester")

# NOTE: The term "toolchain" is a misnomer for this rule. This doesn't define
# a repo with toolchains or toolchain implementations.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What if we rename it to host_compatible_python_repo?

# Repo rules can't accept dict[str, bool], so encode them as a string value.
toolchain_set_python_version_constraints[key] = (
"True" if entry.set_python_version_constraint else "False"
)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Below here, the host_compatible toolchain list should be passed to the pythons_hub so that we keep the right contents in the interpreters.bzl.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants