Skip to content

Commit

Permalink
Also mark python extension as reproducible
Browse files Browse the repository at this point in the history
  • Loading branch information
fmeum committed May 16, 2024
1 parent 186029c commit 9b8878a
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 1 deletion.
1 change: 1 addition & 0 deletions python/extensions/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ bzl_library(
visibility = ["//:__subpackages__"],
deps = [
"//python/private:util_bzl",
"//python/private/bzlmod:bazel_features_bzl",
"//python/private/bzlmod:python_bzl",
],
)
2 changes: 1 addition & 1 deletion python/private/bzlmod/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ bzl_library(

bzl_library(
name = "bazel_features_bzl",
srcs = ["@bazel_features//:bzl_files"],
deps = ["@bazel_features//:features"],
)

bzl_library(
Expand Down
6 changes: 6 additions & 0 deletions python/private/bzlmod/python.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@

"Python toolchain module extensions for use with bzlmod"

load("@bazel_features//:features.bzl", "bazel_features")
load("//python:repositories.bzl", "python_register_toolchains")
load("//python/private:toolchains_repo.bzl", "multi_toolchain_aliases")
load("//python/private:util.bzl", "IS_BAZEL_6_4_OR_HIGHER")
Expand Down Expand Up @@ -230,6 +231,11 @@ def _python_impl(module_ctx):
debug_info = json.encode_indent(debug_info),
)

if bazel_features.external_deps.extension_metadata_has_reproducible:
return module_ctx.extension_metadata(reproducible = True)
else:
return None

def _fail_duplicate_module_toolchain_version(version, module):
fail(("Duplicate module toolchain version: module '{module}' attempted " +
"to use version '{version}' multiple times in itself").format(
Expand Down

0 comments on commit 9b8878a

Please sign in to comment.