Skip to content

Commit d7f2fe1

Browse files
committed
reuse constants
1 parent e14afe9 commit d7f2fe1

File tree

3 files changed

+15
-14
lines changed

3 files changed

+15
-14
lines changed

private/BUILD.bazel

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ load("@rules_multirun//:defs.bzl", "multirun")
44

55
multirun(
66
name = "requirements.update",
7-
testonly = True,
87
commands = [
98
"//tools/publish:{}.update".format(r)
109
for r in [

python/uv/private/BUILD.bazel

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,8 +40,10 @@ bzl_library(
4040
srcs = ["lock.bzl"],
4141
visibility = ["//python/uv:__subpackages__"],
4242
deps = [
43+
":toolchain_types_bzl",
4344
"//python:py_binary_bzl",
4445
"//python/private:bzlmod_enabled_bzl",
46+
"//python/private:toolchain_types_bzl",
4547
"@bazel_skylib//lib:shell",
4648
"@bazel_skylib//rules:expand_template",
4749
],

python/uv/private/lock.bzl

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -45,21 +45,20 @@ load("@bazel_skylib//lib:shell.bzl", "shell")
4545
load("@bazel_skylib//rules:expand_template.bzl", "expand_template")
4646
load("//python:py_binary.bzl", "py_binary")
4747
load("//python/private:bzlmod_enabled.bzl", "BZLMOD_ENABLED") # buildifier: disable=bzl-visibility
48+
load("//python/private:toolchain_types.bzl", "TARGET_TOOLCHAIN_TYPE") # buildifier: disable=bzl-visibility
49+
load(":toolchain_types.bzl", "UV_TOOLCHAIN_TYPE")
4850

4951
visibility(["//..."])
5052

51-
_uv_toolchain = Label("//python/uv:uv_toolchain_type")
52-
_py_toolchain = Label("//python:toolchain_type")
53-
5453
_RunLockInfo = provider(
5554
doc = "",
5655
fields = {
57-
"args": "",
58-
"env": "",
59-
"py": "",
60-
"srcs": "",
61-
"template": "",
62-
"uv": "",
56+
"args": "The args passed to the `uv` by default when running the runnable target.",
57+
"env": "The env passed to the execution.",
58+
"py": "The python runtime",
59+
"srcs": "Source files",
60+
"template": "The template to use for the script.",
61+
"uv": "The path to the uv binary.",
6362
},
6463
)
6564

@@ -69,10 +68,10 @@ def _lock_impl(ctx):
6968
existing_output = ctx.files.existing_output
7069
output = ctx.actions.declare_file(ctx.label.name + ".out")
7170

72-
toolchain_info = ctx.toolchains[_uv_toolchain]
71+
toolchain_info = ctx.toolchains[UV_TOOLCHAIN_TYPE]
7372
uv = toolchain_info.uv_toolchain_info.uv[DefaultInfo].files_to_run.executable
7473

75-
py_runtime = ctx.toolchains[_py_toolchain].py3_runtime
74+
py_runtime = ctx.toolchains[TARGET_TOOLCHAIN_TYPE].py3_runtime
7675

7776
cmd = ctx.actions.declare_file(ctx.label.name)
7877
ctx.actions.expand_template(
@@ -216,8 +215,9 @@ script depending on what the target platform is executed on.
216215
),
217216
},
218217
toolchains = [
219-
_uv_toolchain,
220-
_py_toolchain,
218+
UV_TOOLCHAIN_TYPE,
219+
# FIXME @aignas 2025-03-17: should this be instead EXEC_TOOLCHAIN_TYPE?
220+
TARGET_TOOLCHAIN_TYPE,
221221
],
222222
)
223223

0 commit comments

Comments
 (0)