xref: /aosp_15_r20/external/bazelbuild-rules_python/tests/exec_toolchain_matching/BUILD.bazel (revision 60517a1edbc8ecf509223e9af94a7adec7d736b8)
1# Copyright 2024 The Bazel Authors. All rights reserved.
2#
3# Licensed under the Apache License, Version 2.0 (the "License");
4# you may not use this file except in compliance with the License.
5# You may obtain a copy of the License at
6#
7#    http://www.apache.org/licenses/LICENSE-2.0
8#
9# Unless required by applicable law or agreed to in writing, software
10# distributed under the License is distributed on an "AS IS" BASIS,
11# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12# See the License for the specific language governing permissions and
13# limitations under the License.
14
15load("//python/private:py_exec_tools_toolchain.bzl", "py_exec_tools_toolchain")  # buildifier: disable=bzl-visibility
16load(
17    ":exec_toolchain_matching_tests.bzl",
18    "define_py_runtime",
19    "exec_toolchain_matching_test_suite",
20)
21
22exec_toolchain_matching_test_suite(
23    name = "exec_toolchain_matching_tests",
24)
25
26define_py_runtime(
27    name = "target_3.12_linux",
28    interpreter_path = "/linux/python3.12",
29    interpreter_version_info = {
30        "major": "3",
31        "minor": "12",
32    },
33)
34
35define_py_runtime(
36    name = "target_3.12_mac",
37    interpreter_path = "/mac/python3.12",
38    interpreter_version_info = {
39        "major": "3",
40        "minor": "12",
41    },
42)
43
44define_py_runtime(
45    name = "target_3.12_any",
46    interpreter_path = "/any/python3.11",
47    interpreter_version_info = {
48        "major": "3",
49        "minor": "11",
50    },
51)
52
53define_py_runtime(
54    name = "target_default",
55    interpreter_path = "/should_not_match_anything",
56    interpreter_version_info = {
57        "major": "-1",
58        "minor": "-1",
59    },
60)
61
62# While these have the same definition, we register duplicates with different
63# names because it makes understanding toolchain resolution easier. Toolchain
64# resolution debug output shows the implementation name, not the toolchain()
65# call that was being evaluated.
66py_exec_tools_toolchain(
67    name = "exec_3.12",
68)
69
70py_exec_tools_toolchain(
71    name = "exec_3.11_any",
72)
73
74py_exec_tools_toolchain(
75    name = "exec_default",
76)
77