xref: /aosp_15_r20/external/bazelbuild-rules_python/python/private/reexports.bzl (revision 60517a1edbc8ecf509223e9af94a7adec7d736b8)
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
15"""Internal re-exports of builtin symbols.
16
17We 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.
21
22Unfortunately, we can't just write:
23
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
30different name. Then we can load it from elsewhere.
31"""
32
33# Don't use underscore prefix, since that would make the symbol local to this
34# file only. Use a non-conventional name to emphasize that this is not a public
35# symbol.
36# buildifier: disable=name-conventions
37BuiltinPyInfo = PyInfo
38
39# buildifier: disable=name-conventions
40BuiltinPyRuntimeInfo = PyRuntimeInfo
41