1# Copyright 2023 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"""Implementation of PyCcToolchainInfo.""" 16 17PyCcToolchainInfo = provider( 18 doc = "C/C++ information about the Python runtime.", 19 fields = { 20 "headers": """\ 21:type: struct 22 23Information about the header files, struct with fields: 24 * providers_map: a dict of string to provider instances. The key should be 25 a fully qualified name (e.g. `@rules_foo//bar:baz.bzl#MyInfo`) of the 26 provider to uniquely identify its type. 27 28 The following keys are always present: 29 * CcInfo: the CcInfo provider instance for the headers. 30 * DefaultInfo: the DefaultInfo provider instance for the headers. 31 32 A map is used to allow additional providers from the originating headers 33 target (typically a `cc_library`) to be propagated to consumers (directly 34 exposing a Target object can cause memory issues and is an anti-pattern). 35 36 When consuming this map, it's suggested to use `providers_map.values()` to 37 return all providers; or copy the map and filter out or replace keys as 38 appropriate. Note that any keys beginning with `_` (underscore) are 39 considered private and should be forward along as-is (this better allows 40 e.g. `:current_py_cc_headers` to act as the underlying headers target it 41 represents). 42""", 43 "libs": """\ 44:type: struct | None 45 46If available, information about C libraries, struct with fields: 47 * providers_map: A dict of string to provider instances. The key should be 48 a fully qualified name (e.g. `@rules_foo//bar:baz.bzl#MyInfo`) of the 49 provider to uniquely identify its type. 50 51 The following keys are always present: 52 * CcInfo: the CcInfo provider instance for the libraries. 53 * DefaultInfo: the DefaultInfo provider instance for the headers. 54 55 A map is used to allow additional providers from the originating libraries 56 target (typically a `cc_library`) to be propagated to consumers (directly 57 exposing a Target object can cause memory issues and is an anti-pattern). 58 59 When consuming this map, it's suggested to use `providers_map.values()` to 60 return all providers; or copy the map and filter out or replace keys as 61 appropriate. Note that any keys beginning with `_` (underscore) are 62 considered private and should be forward along as-is (this better allows 63 e.g. `:current_py_cc_headers` to act as the underlying headers target it 64 represents). 65""", 66 "python_version": """ 67:type: str 68 69The Python Major.Minor version. 70""", 71 }, 72) 73