Skip to content

Commit 790ecbe

Browse files
honglookercopybara-github
authored andcommitted
pbtk: setup local toolchain for python
#test-continuous PiperOrigin-RevId: 788602126
1 parent 276701b commit 790ecbe

File tree

2 files changed

+31
-1
lines changed

2 files changed

+31
-1
lines changed

MODULE.bazel

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -154,6 +154,32 @@ pip = use_extension("@rules_python//python/extensions:pip.bzl", "pip", dev_depen
154154

155155
use_repo(pip, "protobuf_pip_deps")
156156

157+
local_runtime_repo = use_repo_rule(
158+
"@rules_python//python/local_toolchains:repos.bzl",
159+
"local_runtime_repo",
160+
)
161+
162+
local_runtime_toolchains_repo = use_repo_rule(
163+
"@rules_python//python/local_toolchains:repos.bzl",
164+
"local_runtime_toolchains_repo",
165+
)
166+
167+
local_runtime_repo(
168+
name = "local_python3",
169+
interpreter_path = "python3",
170+
on_failure = "fail",
171+
)
172+
173+
local_runtime_toolchains_repo(
174+
name = "local_toolchains",
175+
runtimes = ["local_python3"],
176+
)
177+
178+
register_toolchains(
179+
"@local_toolchains//:all",
180+
dev_dependency = True,
181+
)
182+
157183
crate = use_extension("@rules_rust//crate_universe:extension.bzl", "crate", dev_dependency = True)
158184
crate.spec(
159185
package = "googletest",

cmake/dependencies_generator.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,10 @@ def bundle_fetch(self, *args, **kwargs):
4747
pass
4848

4949

50+
def empty_func(*args, **kwargs):
51+
pass
52+
53+
5054
class ModuleFileFunctions(object):
5155
"""A fake MODULE file that we can exec() to get the functions we need."""
5256

@@ -74,7 +78,7 @@ def use_repo(self, *args, **kwargs):
7478
pass
7579

7680
def use_repo_rule(self, *args, **kwargs):
77-
pass
81+
return empty_func
7882

7983
def single_version_override(self, *args, **kwargs):
8084
pass

0 commit comments

Comments
 (0)