Fix cc_configure on Windows -- Change-Id: Id359bc6f442f302e3dbaa60cedd6536ecf4f92ec Reviewed-on: https://bazel-review.googlesource.com/#/c/6333 MOS_MIGRATED_REVID=134575379
diff --git a/tools/cpp/cc_configure.bzl b/tools/cpp/cc_configure.bzl index 235ecbf..69daae5 100644 --- a/tools/cpp/cc_configure.bzl +++ b/tools/cpp/cc_configure.bzl
@@ -372,7 +372,10 @@ def _find_python(repository_ctx): """Find where is python on Windows.""" if "BAZEL_PYTHON" in repository_ctx.os.environ: - return repository_ctx.os.environ["BAZEL_PYTHON"] + python_binary = repository_ctx.os.environ["BAZEL_PYTHON"] + if not python_binary.endswith(".exe"): + python_binary = python_binary + ".exe" + return python_binary auto_configure_warning("'BAZEL_PYTHON' is not set, start looking for python in PATH.") python_binary = _which_cmd(repository_ctx, "python.exe") auto_configure_warning("Python found at %s" % python_binary) @@ -381,7 +384,10 @@ def _find_bash(repository_ctx): """Find where is bash on Windows.""" if "BAZEL_SH" in repository_ctx.os.environ: - return repository_ctx.os.environ["BAZEL_SH"] + bash_binary = repository_ctx.os.environ["BAZEL_SH"] + if not bash_binary.endswith(".exe"): + bash_binary = bash_binary + ".exe" + return bash_binary auto_configure_warning("'BAZEL_SH' is not set, start looking for bash in PATH.") bash_binary = _which_cmd(repository_ctx, "bash.exe") auto_configure_warning("Bash binary found at %s" % bash_binary)