Skip to content

Commit 140518e

Browse files
committed
add py_cc_toolchain attribute
1 parent b582e9a commit 140518e

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

python/private/py_cc_toolchain_rule.bzl

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,13 +34,24 @@ def _py_cc_toolchain_impl(ctx):
3434
else:
3535
libs = None
3636

37+
if ctx.attr.headers_abi3:
38+
headers_abi3 = struct(
39+
providers_map = {
40+
"CcInfo": ctx.attr.headers_abi3[CcInfo],
41+
"DefaultInfo": ctx.attr.headers_abi3[DefaultInfo],
42+
},
43+
)
44+
else:
45+
headers_abi3 = None
46+
3747
py_cc_toolchain = PyCcToolchainInfo(
3848
headers = struct(
3949
providers_map = {
4050
"CcInfo": ctx.attr.headers[CcInfo],
4151
"DefaultInfo": ctx.attr.headers[DefaultInfo],
4252
},
4353
),
54+
headers_abi3 = headers_abi3,
4455
libs = libs,
4556
python_version = ctx.attr.python_version,
4657
)
@@ -61,6 +72,11 @@ py_cc_toolchain = rule(
6172
providers = [CcInfo],
6273
mandatory = True,
6374
),
75+
"headers_abi3": attr.label(
76+
doc = ("Target that provides the Python ABI3 headers. Typically this " +
77+
"is a cc_library target."),
78+
providers = [CcInfo],
79+
),
6480
"libs": attr.label(
6581
doc = ("Target that provides the Python runtime libraries for linking. " +
6682
"Typically this is a cc_library target of `.so` files."),

0 commit comments

Comments
 (0)