• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 built-in symbols.
16
17Currently the definitions here are re-exports of the native rules, "blessed" to
18work under `--incompatible_load_python_rules_from_bzl`. As the native rules get
19migrated to Starlark, their implementations will be removed from here.
20
21We want to re-export a built-in symbol as if it were defined in a Starlark
22file, so that users can for instance do:
23
24```
25load("@rules_python//python:defs.bzl", "PyInfo")
26```
27
28Unfortunately, we can't just write in defs.bzl
29
30```
31PyInfo = PyInfo
32```
33
34because the declaration of module-level symbol `PyInfo` makes the builtin
35inaccessible. So instead we access the builtin here and export it under a
36different name. Then we can load it from defs.bzl and export it there under
37the original name.
38"""
39
40# Don't use underscore prefix, since that would make the symbol local to this
41# file only. Use a non-conventional name to emphasize that this is not a public
42# symbol.
43# buildifier: disable=name-conventions
44internal_PyInfo = PyInfo
45
46# buildifier: disable=name-conventions
47internal_PyRuntimeInfo = PyRuntimeInfo
48