Skip to content

Commit 22f1352

Browse files
authored
fix: Return repo_metadata from python repository rule (bazel-contrib#3598)
This allows the python repository rule to use the remote repo content cache.
1 parent 74e10bd commit 22f1352

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

python/private/python_repository.bzl

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -224,7 +224,15 @@ define_hermetic_runtime_toolchain_impl(
224224
else:
225225
attrs["urls"] = urls
226226

227-
return attrs
227+
# Bazel <8.3.0 lacks repository_ctx.repo_metadata
228+
if not hasattr(rctx, "repo_metadata"):
229+
return attrs
230+
231+
reproducible = rctx.attr.sha256 != ""
232+
return rctx.repo_metadata(
233+
reproducible = reproducible,
234+
attrs_for_reproducibility = {} if reproducible else attrs,
235+
)
228236

229237
python_repository = repository_rule(
230238
_python_repository_impl,

0 commit comments

Comments
 (0)