Add "python 3 only" support for bazel build (#19443)
* Add python 3 only support for bazel build
When building tensorflow in a python3 system (i.e.,
only `/usr/bin/python3`, no `/usr/bin/python`), even
though `/usr/bin/python3` is specified during the configure
the following failure still occur:
```
SUBCOMMAND: # //tensorflow/core:version_info_gen [action 'Executing genrule //tensorflow/core:version_info_gen [for host]']
(cd /home/ubuntu/.cache/bazel/_bazel_ubuntu/
ad1e09741bb4109fbc70ef8216b59ee2/execroot/org_tensorflow && \
exec env - \
PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin \
/bin/bash -c 'source external/bazel_tools/tools/genrule/genrule-setup.sh; tensorflow/tools/git/gen_git_source.py --generate external/local_config_git/gen/spec.json external/local_config_git/gen/head external/local_config_git/gen/branch_ref "bazel-out/host/genfiles/tensorflow/core/util/version_info.cc" --git_tag_override=${GIT_TAG_OVERRIDE:-}')
ERROR: /home/ubuntu/tensorflow/tensorflow/core/BUILD:2015:1: Executing genrule //tensorflow/core:version_info_gen failed (Exit 127)
/usr/bin/env: 'python': No such file or directory
Target //tensorflow/tools/pip_package:build_pip_package failed to build
Use --verbose_failures to see the command lines of failed build steps.
ERROR: /home/ubuntu/tensorflow/tensorflow/tools/api/generator/BUILD:27:1 Executing genrule //tensorflow/core:version_info_gen failed (Exit 127)
INFO: Elapsed time: 391.217s, Critical Path: 46.74s
INFO: 656 processes, local.
FAILED: Build did NOT complete successfully
```
This fix adds the necessary `${PYTHON_BIN_PATH}` (configured already in `./configure`)
into related commands so that bazel build works even in python 3 only environment.
Signed-off-by: Yong Tang <yong.tang.github@outlook.com>
* Fix build failure for api generator in python 3 only environment
Signed-off-by: Yong Tang <yong.tang.github@outlook.com>
* Add `${PYTHON_BIN_PATH}` to cython build
Signed-off-by: Yong Tang <yong.tang.github@outlook.com>
* Optionally add PYTHON_BIN_PATH for non-windows only
Signed-off-by: Yong Tang <yong.tang.github@outlook.com>