Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add "python 3 only" support for bazel build #19443

Merged
merged 4 commits into from
May 30, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
7 changes: 6 additions & 1 deletion tensorflow/core/platform/default/build_config.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,12 @@ def pyx_library(
name = filename + "_cython_translation",
srcs = [filename],
outs = [filename.split(".")[0] + ".cpp"],
cmd = "PYTHONHASHSEED=0 $(location @cython//:cython_binary) --cplus $(SRCS) --output-file $(OUTS)",
# Optionally use PYTHON_BIN_PATH on Linux platforms so that python 3
# works. Windows has issues with cython_binary so skip PYTHON_BIN_PATH.
cmd = "PYTHONHASHSEED=0 " + select({
"@bazel_tools//src/conditions:windows": "",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@meteorcloudy PTAL for windows.

"//conditions:default": "$${PYTHON_BIN_PATH} ",
}) + "$(location @cython//:cython_binary) --cplus $(SRCS) --output-file $(OUTS)",
tools = ["@cython//:cython_binary"] + pxd_srcs,
)

Expand Down
4 changes: 2 additions & 2 deletions tensorflow/tensorflow.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -1716,7 +1716,7 @@ def tf_version_info_genrule():
],
outs=["util/version_info.cc"],
cmd=
"$(location //tensorflow/tools/git:gen_git_source.py) --generate $(SRCS) \"$@\" --git_tag_override=$${GIT_TAG_OVERRIDE:-}",
"$${PYTHON_BIN_PATH} $(location //tensorflow/tools/git:gen_git_source.py) --generate $(SRCS) \"$@\" --git_tag_override=$${GIT_TAG_OVERRIDE:-}",
local=1,
tools=[clean_dep("//tensorflow/tools/git:gen_git_source.py")],)

Expand All @@ -1725,7 +1725,7 @@ def tf_py_build_info_genrule():
name="py_build_info_gen",
outs=["platform/build_info.py"],
cmd=
"$(location //tensorflow/tools/build_info:gen_build_info.py) --raw_generate \"$@\" --build_config " + if_cuda("cuda", "cpu"),
"$${PYTHON_BIN_PATH} $(location //tensorflow/tools/build_info:gen_build_info.py) --raw_generate \"$@\" --build_config " + if_cuda("cuda", "cpu"),
local=1,
tools=[clean_dep("//tensorflow/tools/build_info:gen_build_info.py")],)

Expand Down
8 changes: 7 additions & 1 deletion tensorflow/tools/api/generator/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,13 @@ genrule(
"api/user_ops/__init__.py",
# END GENERATED FILES
],
cmd = "$(location create_python_api) $(OUTS)",
# Optionally use PYTHON_BIN_PATH on Linux platforms so that python 3
# works. Windows has issues with the command so skip PYTHON_BIN_PATH
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

# for now.
cmd = select({
"@bazel_tools//src/conditions:windows": "",
"//conditions:default": "$${PYTHON_BIN_PATH} ",
}) + "$(location create_python_api) $(OUTS)",
tools = ["create_python_api"],
)

Expand Down