diff --git a/python/extensions/BUILD.bazel b/python/extensions/BUILD.bazel index a9dede44ec..9953d2ac6e 100644 --- a/python/extensions/BUILD.bazel +++ b/python/extensions/BUILD.bazel @@ -38,5 +38,6 @@ bzl_library( deps = [ "//python/private:util_bzl", "//python/private/bzlmod:python_bzl", + "//python/private/bzlmod:bazel_features_bzl", ], ) diff --git a/python/private/bzlmod/BUILD.bazel b/python/private/bzlmod/BUILD.bazel index 0ec95e4bed..9edd3380bb 100644 --- a/python/private/bzlmod/BUILD.bazel +++ b/python/private/bzlmod/BUILD.bazel @@ -45,7 +45,7 @@ bzl_library( bzl_library( name = "bazel_features_bzl", - srcs = ["@bazel_features//:bzl_files"], + deps = ["@bazel_features//:features"], ) bzl_library( diff --git a/python/private/bzlmod/python.bzl b/python/private/bzlmod/python.bzl index 5862f00d7b..f8be271fd6 100644 --- a/python/private/bzlmod/python.bzl +++ b/python/private/bzlmod/python.bzl @@ -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") @@ -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(