blob: e9d2ded33e47b217e460e16b26c88af4eb5adc22 [file] [log] [blame]
Jon Brandvein522222a2019-07-26 23:35:39 -04001# 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 Levasseurf6766562023-11-21 12:55:33 -080015"""Internal re-exports of builtin symbols.
Jon Brandvein522222a2019-07-26 23:35:39 -040016
Richard Levasseurf6766562023-11-21 12:55:33 -080017We want to use both the PyInfo defined by builtins and the one defined by
18rules_python. Because the builtin symbol is going away, the rules_python
19PyInfo symbol is given preference. Unfortunately, that masks the builtin,
20so we have to rebind it to another name and load it to make it available again.
Matt Mackay702a5c52022-06-30 12:43:16 -040021
Richard Levasseurf6766562023-11-21 12:55:33 -080022Unfortunately, we can't just write:
Jon Brandvein522222a2019-07-26 23:35:39 -040023
24```
25PyInfo = PyInfo
26```
27
28because the declaration of module-level symbol `PyInfo` makes the builtin
29inaccessible. So instead we access the builtin here and export it under a
Richard Levasseurf6766562023-11-21 12:55:33 -080030different name. Then we can load it from elsewhere.
Jon Brandvein522222a2019-07-26 23:35:39 -040031"""
32
Ivo List84ff5772024-10-08 20:01:39 +020033load("@rules_python_internal//:rules_python_config.bzl", "config")
Marcel Hlopko230f6d12019-10-23 23:28:11 +020034
Ivo List84ff5772024-10-08 20:01:39 +020035# NOTE: May be None (Bazel 8 autoloading rules_python)
Marcel Hlopko230f6d12019-10-23 23:28:11 +020036# buildifier: disable=name-conventions
Ivo List84ff5772024-10-08 20:01:39 +020037BuiltinPyInfo = config.BuiltinPyInfo
38
39# NOTE: May be None (Bazel 8 autoloading rules_python)
40# buildifier: disable=name-conventions
41BuiltinPyRuntimeInfo = config.BuiltinPyRuntimeInfo