Avoid 'which' failure

pull/17644/head
Lidi Zheng 6 years ago
parent 17fa4b0caf
commit ee23fc3d2e
  1. 7
      third_party/py/python_configure.bzl

@ -139,7 +139,12 @@ def _symlink_genrule_for_dir(repository_ctx,
def _get_python_bin(repository_ctx):
"""Gets the python bin path."""
python_bin = repository_ctx.os.environ.get(_PYTHON_BIN_PATH, 'python')
python_bin_path = repository_ctx.which(python_bin)
if not '/' in python_bin and not '\\' in python_bin:
# It's a command, use 'which' to find its path.
python_bin_path = repository_ctx.which(python_bin)
else:
# It's a path, use it as it is.
python_bin_path = python_bin
if python_bin_path != None:
return str(python_bin_path)
_fail("Cannot find python in PATH, please make sure " +

Loading…
Cancel
Save