diff --git a/bazel/private/BUILD b/bazel/private/BUILD index b8cee5468c3b1..1369c7941848f 100644 --- a/bazel/private/BUILD +++ b/bazel/private/BUILD @@ -7,6 +7,11 @@ toolchain_type( name = "proto_toolchain_type", ) +toolchain_type( + name = "python_toolchain_type", + visibility = ["//visibility:public"], +) + bzl_library( name = "upb_proto_library_internal_bzl", srcs = [ diff --git a/bazel/py_proto_library.bzl b/bazel/py_proto_library.bzl index 6e3d041f369aa..1c40598422282 100644 --- a/bazel/py_proto_library.bzl +++ b/bazel/py_proto_library.bzl @@ -5,7 +5,7 @@ load("//bazel/common:proto_common.bzl", "proto_common") load("//bazel/common:proto_info.bzl", "ProtoInfo") load("//bazel/private:toolchain_helpers.bzl", "toolchains") -PY_PROTO_TOOLCHAIN = "@rules_python//python/proto:toolchain_type" +_PY_PROTO_TOOLCHAIN = Label("//bazel/private:python_toolchain_type") _PyProtoInfo = provider( doc = "Encapsulates information needed by the Python proto rules.", @@ -50,9 +50,9 @@ def _py_proto_aspect_impl(target, ctx): )) if proto_common.INCOMPATIBLE_ENABLE_PROTO_TOOLCHAIN_RESOLUTION: - toolchain = ctx.toolchains[PY_PROTO_TOOLCHAIN] + toolchain = ctx.toolchains[_PY_PROTO_TOOLCHAIN] if not toolchain: - fail("No toolchains registered for '%s'." % PY_PROTO_TOOLCHAIN) + fail("No toolchains registered for '%s'." % _PY_PROTO_TOOLCHAIN) proto_lang_toolchain_info = toolchain.proto else: proto_lang_toolchain_info = getattr(ctx.attr, "_aspect_proto_toolchain")[proto_common.ProtoLangToolchainInfo] @@ -126,7 +126,7 @@ _py_proto_aspect = aspect( attr_aspects = ["deps"], required_providers = [ProtoInfo], provides = [_PyProtoInfo], - toolchains = toolchains.use_toolchain(PY_PROTO_TOOLCHAIN), + toolchains = toolchains.use_toolchain(_PY_PROTO_TOOLCHAIN), ) def _py_proto_library_rule(ctx):