//python/private:py_cc_toolchain_rule.bzl
Implementation of py_cc_toolchain rule.
NOTE: This is a beta-quality feature. APIs subject to change until https://github.com/bazel-contrib/rules_python/issues/824 is considered done.
- rule py_cc_toolchain(name, headers, python_version, headers_abi3='@rules_python//python:none', libs=None)
A toolchain for a Python runtime’s C/C++ information (e.g. headers)
This rule carries information about the C/C++ side of a Python runtime, e.g. headers, shared libraries, etc.
This provides
ToolchainInfowith the following attributes:py_cc_toolchain:PyCcToolchainInfotoolchain_label:Labelonly present when--visibile_for_testing=Truefor internal testing. The rule’s label; this allows identifying what toolchain implmentation was selected for testing purposes.
- Attributes:
A unique name for this target.
mandatory
Target that provides the Python headers. Typically this is a cc_library target.
mandatory
Required providers:
CcInfopython_version– (str)The Major.minor Python version, e.g. 3.11
mandatory
headers_abi3– (label) (default “@rules_python//python:none”)Target that provides the Python ABI3 (stable abi) headers.
Typically this is a cc_library target.
Added in version 1.7.0: The
features.headers_abi3attribute can be used to detect if this attribute is available or not.optional
Required providers:
SentinelInfo|CcInfoTarget that provides the Python runtime libraries for linking. Typically this is a cc_library target of
.sofiles.optional
Required providers:
CcInfo