Skip to content

Commit 6c9f855

Browse files
committed
add validation for python_path
1 parent ebebeca commit 6c9f855

File tree

2 files changed

+3
-2
lines changed

2 files changed

+3
-2
lines changed

python/private/py_executable.bzl

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1136,6 +1136,9 @@ def _get_runtime_details(ctx, semantics):
11361136
# TOOD(bazelbuild/bazel#7901): Remove this once --python_path flag is removed.
11371137

11381138
flag_interpreter_path = read_possibly_native_flag(ctx, "python_path")
1139+
if not flag_interpreter_path.startswith("python") and not paths.is_absolute(flag_interpreter_path):
1140+
fail("python_path must be an absolute path when it is set.")
1141+
11391142
toolchain_runtime, effective_runtime = _maybe_get_runtime_from_ctx(ctx)
11401143
if not effective_runtime:
11411144
# Clear these just in case

tests/integration/ignore_root_user_error/WORKSPACE

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
2-
31
local_repository(
42
name = "rules_python",
53
path = "../../..",

0 commit comments

Comments
 (0)