blob: eebfbcaa58aba69c1ca40582b3190821258fed62 [file]
module(
name = "other_module",
)
# This module is using the same version of rules_python
# that the parent module uses.
bazel_dep(name = "rules_python", version = "")
# It is not best practice to use a python.toolchian in
# a submodule. This code only exists to test that
# we support doing this. This code is only for rules_python
# testing purposes.
PYTHON_NAME_39 = "python_39"
PYTHON_39_TOOLCHAINS = PYTHON_NAME_39 + "_toolchains"
PYTHON_NAME_311 = "python_311"
PYTHON_311_TOOLCHAINS = PYTHON_NAME_311 + "_toolchains"
python = use_extension("@rules_python//python/extensions:python.bzl", "python")
python.toolchain(
# This name is used in the various use_repo statements
# below, and in the local extension that is in this
# example.
name = PYTHON_NAME_39,
configure_coverage_tool = True,
python_version = "3.9",
)
python.toolchain(
# This name is used in the various use_repo statements
# below, and in the local extension that is in this
# example.
name = PYTHON_NAME_311,
configure_coverage_tool = True,
# In a submodule this is ignored
is_default = True,
python_version = "3.11",
)
# created by the above python.toolchain calls.
use_repo(
python,
PYTHON_NAME_39,
PYTHON_39_TOOLCHAINS,
PYTHON_NAME_311,
PYTHON_311_TOOLCHAINS,
)
# This call registers the Python toolchains.
# Note: there is work under way to move this code to within
# rules_python, and the user won't have to make this call,
# unless they are registering custom toolchains.
register_toolchains(
"@{}//:all".format(PYTHON_39_TOOLCHAINS),
"@{}//:all".format(PYTHON_311_TOOLCHAINS),
)