Skip to content

Commit

Permalink
Ensure that the autodetected python runtimes are marked as compatible
Browse files Browse the repository at this point in the history
with the host platform.

This should prevent them from being used inappropriately in remote
execution.

Part of changes for bazelbuild#20354.
  • Loading branch information
katre committed Nov 29, 2023
1 parent 18b9da9 commit 64cfc99
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions tools/python/toolchain.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@

"""Definitions related to the Python toolchain."""

load("@local_config_platform//:constraints.bzl", "HOST_CONSTRAINTS")
load(":utils.bzl", "expand_pyversion_template")

# TODO: move py_runtime_pair into rules_python (and the rest of @bazel_tools//python)
Expand Down Expand Up @@ -242,11 +243,13 @@ def define_autodetecting_toolchain(
toolchain = ":_autodetecting_py_runtime_pair",
toolchain_type = ":toolchain_type",
visibility = ["//visibility:public"],
exec_compatible_with = HOST_CONSTRAINTS,
)

native.toolchain(
name = name + "_nonstrict",
toolchain = ":_autodetecting_py_runtime_pair_nonstrict",
toolchain_type = ":toolchain_type",
visibility = ["//visibility:public"],
exec_compatible_with = HOST_CONSTRAINTS,
)

0 comments on commit 64cfc99

Please sign in to comment.