-
Notifications
You must be signed in to change notification settings - Fork 559
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
fix(uv): fix UV_BIN usage with current_toolchain #2074
Conversation
Before this PR the `uv` toolchain could not be used in a `genrule` it seems because the `//python/uv:toolchain` does not have the necessary providers for using the make variables and the re-exporting of the make variables from the `toolchain` in the `current_toolchain` rule did not seem to work. This PR removes the provider construction in the `toolchain` and does that only in the `current_toolchain`. This better mirrors how the Python toolchains are setup (grepping `PYTHON3` is sufficient to get examples). This also splits out work done in bazelbuild#2059 to decrease its scope, so that this can be discussed separately. Work towards bazelbuild#1975
@@ -30,7 +30,9 @@ def _current_toolchain_impl(ctx): | |||
# Bazel requires executable rules to create the executable themselves, | |||
# so we create a symlink in this rule so that it appears this rule created its executable. | |||
original_uv_executable = toolchain_info.uv_toolchain_info.uv[DefaultInfo].files_to_run.executable | |||
symlink_uv_executable = ctx.actions.declare_file("uv_symlink_{}".format(original_uv_executable.basename)) | |||
|
|||
# Use `uv` as the name of the binary to make the help message well formatted |
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.
nit: The only reason I went with a weird name, was because I was worried about Windows. I might be wrong, but I thought Windows requires(ed) that executables have the .exe
suffix?
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.
LGTM
Regarding the name of the binary, it seems that the CI is happy, so I'll roll I think the |
Before this PR the
uv
toolchain could not be used in agenrule
itseems because the
//python/uv:toolchain
does not have the necessaryproviders for using the make variables and the re-exporting of the make
variables from the
toolchain
in thecurrent_toolchain
rule did notseem to work.
This PR removes the provider construction in the
toolchain
and doesthat only in the
current_toolchain
. This better mirrors how the Pythontoolchains are setup (grepping
PYTHON3
is sufficient to get examples).This also splits out work done in #2059 to decrease its scope, so that
this can be discussed separately.
Work towards #1975