Skip to content

Commit 822f1d8

Browse files
committed
convert bin/python3 to python.exe
1 parent c9ef8f8 commit 822f1d8

File tree

2 files changed

+6
-5
lines changed

2 files changed

+6
-5
lines changed

python/private/local_runtime_repo.bzl

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -277,10 +277,11 @@ def _find_python_exe_from_target(rctx):
277277
return base_path, None
278278
attempted_paths = [base_path]
279279

280-
# On Windows, python.exe is in the root, not under `bin/`, so
281-
# go up a directory
282-
283-
path = base_path.dirname.dirname.get_child(base_path.basename)
280+
# Try to convert a unix-y path to a Windows path. On Linux/Mac,
281+
# the path is usually `bin/python3`. On Windows, it's simply
282+
# `python.exe`.
283+
basename = base_path.basename.rstrip("3")
284+
path = base_path.dirname.dirname.get_child(basename)
284285
path = rctx.path("{}.exe".format(path))
285286
if path.exists:
286287
return path, None

tests/integration/local_toolchains/MODULE.bazel

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ pbs_archive(
5656
# installation.
5757
local_runtime_repo(
5858
name = "repo_python3",
59-
interpreter_target = "@pbs_runtime//:python/bin/python3",
59+
interpreter_target = "@pbs_runtime//:python/bin/python",
6060
on_failure = "fail",
6161
)
6262

0 commit comments

Comments
 (0)