Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 8 additions & 2 deletions py/private/interpreter/repository.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -309,9 +309,15 @@ config_setting(
exec_compatible_with = info["compatible_with"] + extra_exec_compatible

content.append("""
# The Python interpreter toolchain has no exec_compatible_with: the interpreter
# runs on the TARGET platform (inside the virtualenv), not on the exec host.
# Setting exec_compatible_with = platform_constraints would prevent this
# toolchain from being selected during cross-compilation (e.g. building an
# arm64 image on an amd64 host), because the exec platform (amd64) would not
# satisfy the arm64 exec constraint. The target_compatible_with constraint is
# sufficient to pick the right interpreter for the target.
toolchain(
name = "{name}",
exec_compatible_with = {exec_compatible_with},
target_compatible_with = {target_compatible_with},
target_settings = {target_settings},
toolchain = "@{repo}//:runtime_pair",
Expand All @@ -323,7 +329,7 @@ toolchain(
# binary on the build host regardless of the target platform being built for.
toolchain(
name = "{name}_exec_tools",
exec_compatible_with = {target_compatible_with},
exec_compatible_with = {exec_compatible_with},
toolchain = "@{repo}//:exec_tools_toolchain",
toolchain_type = "@aspect_rules_py//py/private/toolchain:exec_tools_toolchain_type",
)
Expand Down
Loading