Look for python3 before python on PATH
TF no longer supports python2. This ensures that python3 will be picked up if available under the common "python3" name in the PATH. PiperOrigin-RevId: 338014609 Change-Id: Iaf0ee14e3ebbbcd72cf4ef15050bdc4b5968c525
This commit is contained in:
parent
495a9f4ac2
commit
ddb837a810
27
third_party/remote_config/common.bzl
vendored
27
third_party/remote_config/common.bzl
vendored
@ -41,15 +41,24 @@ def get_python_bin(repository_ctx):
|
||||
python_bin = get_host_environ(repository_ctx, PYTHON_BIN_PATH)
|
||||
if python_bin != None:
|
||||
return python_bin
|
||||
python_bin_path = which(repository_ctx, "python")
|
||||
if python_bin_path == None:
|
||||
auto_config_fail("Cannot find python in PATH, please make sure " +
|
||||
"python is installed and add its directory in PATH, or --define " +
|
||||
"%s='/something/else'.\nPATH=%s" % (
|
||||
PYTHON_BIN_PATH,
|
||||
get_environ("PATH", ""),
|
||||
))
|
||||
return python_bin_path
|
||||
|
||||
# First check for an explicit "python3"
|
||||
python_bin = which(repository_ctx, "python3")
|
||||
if python_bin != None:
|
||||
return python_bin
|
||||
|
||||
# Some systems just call pythone3 "python"
|
||||
python_bin = which(repository_ctx, "python")
|
||||
if python_bin != None:
|
||||
return python_bin
|
||||
|
||||
auto_config_fail("Cannot find python in PATH, please make sure " +
|
||||
"python is installed and add its directory in PATH, or --define " +
|
||||
"%s='/something/else'.\nPATH=%s" % (
|
||||
PYTHON_BIN_PATH,
|
||||
get_environ("PATH", ""),
|
||||
))
|
||||
return python_bin # unreachable
|
||||
|
||||
def get_bash_bin(repository_ctx):
|
||||
"""Gets the bash bin path.
|
||||
|
Loading…
Reference in New Issue
Block a user