Skip to content

Commit 63379a4

Browse files
authored
Fix misleading error message (bazel-contrib#927)
When `rctx.which` can not find a program for the specified name, it returns `None`. We should not override the original `python_interpreter` in this case, otherwise we'll see a misleading error message like `Error in fail: python interpreter `None` not found in PATH`
1 parent a475144 commit 63379a4

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

python/pip_install/pip_repository.bzl

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -60,11 +60,11 @@ def _resolve_python_interpreter(rctx):
6060
if rctx.attr.python_interpreter_target != None:
6161
target = rctx.attr.python_interpreter_target
6262
python_interpreter = rctx.path(target)
63-
else:
64-
if "/" not in python_interpreter:
65-
python_interpreter = rctx.which(python_interpreter)
66-
if not python_interpreter:
63+
elif "/" not in python_interpreter:
64+
found_python_interpreter = rctx.which(python_interpreter)
65+
if not found_python_interpreter:
6766
fail("python interpreter `{}` not found in PATH".format(python_interpreter))
67+
python_interpreter = found_python_interpreter
6868
return python_interpreter
6969

7070
def _get_xcode_location_cflags(rctx):

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy