Jon Brandvein | 522222a | 2019-07-26 23:35:39 -0400 | [diff] [blame] | 1 | # Copyright 2019 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 | |
Richard Levasseur | f676656 | 2023-11-21 12:55:33 -0800 | [diff] [blame] | 15 | """Internal re-exports of builtin symbols. |
Jon Brandvein | 522222a | 2019-07-26 23:35:39 -0400 | [diff] [blame] | 16 | |
Richard Levasseur | f676656 | 2023-11-21 12:55:33 -0800 | [diff] [blame] | 17 | We want to use both the PyInfo defined by builtins and the one defined by |
| 18 | rules_python. Because the builtin symbol is going away, the rules_python |
| 19 | PyInfo symbol is given preference. Unfortunately, that masks the builtin, |
| 20 | so we have to rebind it to another name and load it to make it available again. |
Matt Mackay | 702a5c5 | 2022-06-30 12:43:16 -0400 | [diff] [blame] | 21 | |
Richard Levasseur | f676656 | 2023-11-21 12:55:33 -0800 | [diff] [blame] | 22 | Unfortunately, we can't just write: |
Jon Brandvein | 522222a | 2019-07-26 23:35:39 -0400 | [diff] [blame] | 23 | |
| 24 | ``` |
| 25 | PyInfo = PyInfo |
| 26 | ``` |
| 27 | |
| 28 | because the declaration of module-level symbol `PyInfo` makes the builtin |
| 29 | inaccessible. So instead we access the builtin here and export it under a |
Richard Levasseur | f676656 | 2023-11-21 12:55:33 -0800 | [diff] [blame] | 30 | different name. Then we can load it from elsewhere. |
Jon Brandvein | 522222a | 2019-07-26 23:35:39 -0400 | [diff] [blame] | 31 | """ |
| 32 | |
Ivo List | 84ff577 | 2024-10-08 20:01:39 +0200 | [diff] [blame] | 33 | load("@rules_python_internal//:rules_python_config.bzl", "config") |
Marcel Hlopko | 230f6d1 | 2019-10-23 23:28:11 +0200 | [diff] [blame] | 34 | |
Ivo List | 84ff577 | 2024-10-08 20:01:39 +0200 | [diff] [blame] | 35 | # NOTE: May be None (Bazel 8 autoloading rules_python) |
Marcel Hlopko | 230f6d1 | 2019-10-23 23:28:11 +0200 | [diff] [blame] | 36 | # buildifier: disable=name-conventions |
Ivo List | 84ff577 | 2024-10-08 20:01:39 +0200 | [diff] [blame] | 37 | BuiltinPyInfo = config.BuiltinPyInfo |
| 38 | |
| 39 | # NOTE: May be None (Bazel 8 autoloading rules_python) |
| 40 | # buildifier: disable=name-conventions |
| 41 | BuiltinPyRuntimeInfo = config.BuiltinPyRuntimeInfo |