Skip to content

Commit 3e83327

Browse files
honglookercopybara-github
authored andcommitted
pbtk: abrogate system_python headers with rules_python cc headers
#test-continuous PiperOrigin-RevId: 782898514
1 parent 930036a commit 3e83327

File tree

3 files changed

+17
-4
lines changed

3 files changed

+17
-4
lines changed

MODULE.bazel

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -140,6 +140,7 @@ use_repo(
140140
python,
141141
system_python = "python_{}".format(SUPPORTED_PYTHON_VERSIONS[-1].replace(".", "_")),
142142
)
143+
# use_repo(python, "python")
143144

144145
pip = use_extension("@rules_python//python/extensions:pip.bzl", "pip", dev_dependency = True)
145146

WORKSPACE

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,10 +27,16 @@ load("@bazel_features//:deps.bzl", "bazel_features_deps")
2727

2828
bazel_features_deps()
2929

30-
load("@rules_python//python:repositories.bzl", "py_repositories")
30+
load("@rules_python//python:repositories.bzl", "py_repositories", "python_register_toolchains")
3131

3232
py_repositories()
3333

34+
#python_register_toolchains(
35+
# name = "python_latest",
36+
# python_version = "3.12",
37+
#)
38+
register_toolchains("@rules_python//python/runtime_env_toolchains:all")
39+
3440
# Bazel platform rules.
3541
http_archive(
3642
name = "platforms",

python/build_targets.bzl

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,9 @@ def build_targets(name):
9898
],
9999
deps = select({
100100
"//conditions:default": [],
101-
":use_fast_cpp_protos": ["@system_python//:python_headers"],
101+
":use_fast_cpp_protos": ["@rules_python//python/cc:current_py_cc_headers"],
102+
#":use_fast_cpp_protos": ["@python//python/cc:current_py_cc_headers"],
103+
#":use_fast_cpp_protos": ["@python//cc:current_py_cc_headers"],
102104
}),
103105
)
104106

@@ -154,7 +156,9 @@ def build_targets(name):
154156
"@abseil-cpp//absl/strings",
155157
] + select({
156158
"//conditions:default": [],
157-
":use_fast_cpp_protos": ["@system_python//:python_headers"],
159+
":use_fast_cpp_protos": ["@rules_python//python/cc:current_py_cc_headers"],
160+
# ":use_fast_cpp_protos": ["@python//python/cc:current_py_cc_headers"],
161+
#":use_fast_cpp_protos": ["@python//cc:current_py_cc_headers"],
158162
}),
159163
)
160164

@@ -459,7 +463,9 @@ def build_targets(name):
459463
"//src/google/protobuf/io",
460464
"@abseil-cpp//absl/log:absl_check",
461465
"@abseil-cpp//absl/status",
462-
"@system_python//:python_headers",
466+
"@rules_python//python/cc:current_py_cc_headers",
467+
#"@python//python/cc:current_py_cc_headers",
468+
#"@python//cc:current_py_cc_headers",
463469
],
464470
)
465471

0 commit comments

Comments
 (0)