Skip to content

Commit 74e10bd

Browse files
authored
fix: Return repo_metadata from uv repository rule (#3597)
This allows the uv repository rule to use the remote repo content cache.
1 parent 4be1f1f commit 74e10bd

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

python/uv/private/uv_repository.bzl

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,14 +57,24 @@ def _uv_repo_impl(repository_ctx):
5757
),
5858
)
5959

60-
return {
60+
attrs = {
6161
"name": repository_ctx.attr.name,
6262
"platform": repository_ctx.attr.platform,
6363
"sha256": result.sha256,
6464
"urls": repository_ctx.attr.urls,
6565
"version": repository_ctx.attr.version,
6666
}
6767

68+
# Bazel <8.3.0 lacks repository_ctx.repo_metadata
69+
if not hasattr(repository_ctx, "repo_metadata"):
70+
return attrs
71+
72+
reproducible = repository_ctx.attr.sha256 != ""
73+
return repository_ctx.repo_metadata(
74+
reproducible = reproducible,
75+
attrs_for_reproducibility = {} if reproducible else attrs,
76+
)
77+
6878
uv_repository = repository_rule(
6979
_uv_repo_impl,
7080
doc = "Fetch external tools needed for uv toolchain",

0 commit comments

Comments
 (0)