mongo/bazel/toolchains/python/python_toolchain.BUILD.tmpl
Zack Winter a62ba86084 SERVER-121918: Implement MacOS Cross Compilation with RBE (#49787)
GitOrigin-RevId: 6f2ab2faab8d2503c77373ca2f086d4a8668f711
2026-03-18 17:31:27 +00:00

44 lines
1.4 KiB
Cheetah

load("@rules_python//python:defs.bzl", "py_runtime", "py_runtime_pair")
filegroup(
name = "files",
srcs = glob(
include=["dist/**/*"],
# bazel runfiles do not support paths with spaces
# https://github.com/bazelbuild/bazel/issues/4327
# The setuptools developers will not remove the spaces from these files
# https://github.com/pypa/setuptools/issues/746
exclude=["**/setuptools/**/* *", "**/*.pyc"]),
visibility = ["//visibility:public"],
)
filegroup(
name = "interpreter",
srcs = ["{interpreter_path}"],
visibility = ["//visibility:public"],
)
py_runtime(
name = "py_runtime",
files = [":files"],
interpreter = ":interpreter",
python_version = "PY3",
visibility = ["//visibility:public"],
)
py_runtime_pair(
name = "py_runtime_pair",
py2_runtime = None,
py3_runtime = ":py_runtime",
)
toolchain(
name = "python_toolchain",
exec_compatible_with = [{constraints}],
# NOTE: Do NOT set target_compatible_with for Python toolchains.
# Python is used for exec (build-time) actions only, not for producing
# target artifacts. Setting target_compatible_with breaks cross-compilation
# because Bazel would try to find a Python that runs on the target platform.
toolchain = ":py_runtime_pair",
toolchain_type = "@rules_python//python:toolchain_type",
)