From ba579a36e13a8b9557cbf26fe3b509b4b292d035 Mon Sep 17 00:00:00 2001 From: Morten Mjelva Date: Sat, 14 Feb 2026 11:28:28 +0100 Subject: [PATCH] fix: Return repo_metadata from uv repository rule --- python/uv/private/uv_repository.bzl | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/python/uv/private/uv_repository.bzl b/python/uv/private/uv_repository.bzl index fed4f576d3..79a6495bdc 100644 --- a/python/uv/private/uv_repository.bzl +++ b/python/uv/private/uv_repository.bzl @@ -57,7 +57,7 @@ def _uv_repo_impl(repository_ctx): ), ) - return { + attrs = { "name": repository_ctx.attr.name, "platform": repository_ctx.attr.platform, "sha256": result.sha256, @@ -65,6 +65,16 @@ def _uv_repo_impl(repository_ctx): "version": repository_ctx.attr.version, } + # Bazel <8.3.0 lacks repository_ctx.repo_metadata + if not hasattr(repository_ctx, "repo_metadata"): + return attrs + + reproducible = repository_ctx.attr.sha256 != "" + return repository_ctx.repo_metadata( + reproducible = reproducible, + attrs_for_reproducibility = {} if reproducible else attrs, + ) + uv_repository = repository_rule( _uv_repo_impl, doc = "Fetch external tools needed for uv toolchain",