Skip to content

Commit dcc78b6

Browse files
committed
basic current_py_cc_headers_abi analysis test
1 parent 1002d96 commit dcc78b6

File tree

4 files changed

+24
-5
lines changed

4 files changed

+24
-5
lines changed

python/private/py_cc_toolchain_info.bzl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ Information about the header files, struct with fields:
3939
considered private and should be forward along as-is (this better allows
4040
e.g. `:current_py_cc_headers` to act as the underlying headers target it
4141
represents).
42-
"",
42+
""",
4343
"headers_abi3": """
4444
:type: struct | None
4545
@@ -67,7 +67,7 @@ fields:
6767
:::{versionadded} VERSION_NEXT_FEATURE
6868
:::
6969
""",
70-
"libs": "\
70+
"libs": """
7171
:type: struct | None
7272
7373
If available, information about C libraries, struct with fields:

python/private/py_cc_toolchain_rule.bzl

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -73,8 +73,8 @@ py_cc_toolchain = rule(
7373
mandatory = True,
7474
),
7575
"headers_abi3": attr.label(
76-
doc = ""
77-
Target that provides the Python ABI3 headers.
76+
doc = """
77+
Target that provides the Python ABI3 (stable abi) headers.
7878
7979
Typically this is a cc_library target.
8080
@@ -96,7 +96,7 @@ Typically this is a cc_library target.
9696
default = labels.VISIBLE_FOR_TESTING,
9797
),
9898
},
99-
doc = """\
99+
doc = """
100100
A toolchain for a Python runtime's C/C++ information (e.g. headers)
101101
102102
This rule carries information about the C/C++ side of a Python runtime, e.g.

tests/cc/current_py_cc_headers/current_py_cc_headers_tests.bzl

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,24 @@ def _test_toolchain_is_registered_by_default_impl(env, target):
7676

7777
_tests.append(_test_toolchain_is_registered_by_default)
7878

79+
def _test_current_toolchain_headers_abi3(name):
80+
analysis_test(
81+
name = name,
82+
impl = _test_current_toolchain_headers_impl,
83+
target = "//python/cc:current_py_cc_headers_abi3",
84+
config_settings = {
85+
"//command_line_option:extra_toolchains": [CC_TOOLCHAIN],
86+
},
87+
attrs = {
88+
"header": attr.label(
89+
default = "//tests/support/cc_toolchains:fake_header.h",
90+
allow_single_file = True,
91+
),
92+
},
93+
)
94+
95+
_tests.append(_test_current_toolchain_headers_abi3)
96+
7997
def current_py_cc_headers_test_suite(name):
8098
test_suite(
8199
name = name,

tests/support/cc_toolchains/BUILD.bazel

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ toolchain(
3838
py_cc_toolchain(
3939
name = "fake_py_cc_toolchain_impl",
4040
headers = ":fake_headers",
41+
headers_abi3 = ":fake_headers",
4142
libs = ":fake_libs",
4243
python_version = "3.999",
4344
tags = PREVENT_IMPLICIT_BUILDING_TAGS,

0 commit comments

Comments
 (0)