From a4799e524677ac8eb16dcff691323020bb4d807e Mon Sep 17 00:00:00 2001
From: "A. Unique TensorFlower" <gardener@tensorflow.org>
Date: Wed, 3 Jun 2020 11:52:16 -0700
Subject: [PATCH] allow python tracer(using embedded python internally) to be
 linked to pywrap_tensorflow target by default for google platform.

PiperOrigin-RevId: 314574561
Change-Id: I141ddcb5129abeedfff505b7a7c6ce43acb03bc1
---
 tensorflow/core/platform/build_config_root.bzl         | 2 ++
 tensorflow/core/platform/default/build_config_root.bzl | 3 +++
 tensorflow/python/BUILD                                | 5 +++--
 3 files changed, 8 insertions(+), 2 deletions(-)

diff --git a/tensorflow/core/platform/build_config_root.bzl b/tensorflow/core/platform/build_config_root.bzl
index 5514ccd3fbf..c5626ca8d8c 100644
--- a/tensorflow/core/platform/build_config_root.bzl
+++ b/tensorflow/core/platform/build_config_root.bzl
@@ -9,6 +9,7 @@ load(
     _tf_additional_grpc_deps_py = "tf_additional_grpc_deps_py",
     _tf_additional_license_deps = "tf_additional_license_deps",
     _tf_additional_plugin_deps = "tf_additional_plugin_deps",
+    _tf_additional_profiler_deps = "tf_additional_profiler_deps",
     _tf_additional_xla_deps_py = "tf_additional_xla_deps_py",
     _tf_cuda_tests_tags = "tf_cuda_tests_tags",
     _tf_exec_properties = "tf_exec_properties",
@@ -23,6 +24,7 @@ register_extension_info = _register_extension_info
 tf_additional_grpc_deps_py = _tf_additional_grpc_deps_py
 tf_additional_license_deps = _tf_additional_license_deps
 tf_additional_plugin_deps = _tf_additional_plugin_deps
+tf_additional_profiler_deps = _tf_additional_profiler_deps
 tf_additional_xla_deps_py = _tf_additional_xla_deps_py
 tf_cuda_tests_tags = _tf_cuda_tests_tags
 tf_exec_properties = _tf_exec_properties
diff --git a/tensorflow/core/platform/default/build_config_root.bzl b/tensorflow/core/platform/default/build_config_root.bzl
index 8b3119cec0d..3afe1de58df 100644
--- a/tensorflow/core/platform/default/build_config_root.bzl
+++ b/tensorflow/core/platform/default/build_config_root.bzl
@@ -35,6 +35,9 @@ def tf_additional_plugin_deps():
         "//conditions:default": [],
     })
 
+def tf_additional_profiler_deps():
+    return []
+
 def tf_additional_xla_deps_py():
     return []
 
diff --git a/tensorflow/python/BUILD b/tensorflow/python/BUILD
index 682d15712b7..425ab1f2bbe 100644
--- a/tensorflow/python/BUILD
+++ b/tensorflow/python/BUILD
@@ -32,7 +32,7 @@ load("//tensorflow:tensorflow.bzl", "tf_py_test")
 # buildifier: disable=same-origin-load
 load("//tensorflow:tensorflow.bzl", "tf_py_build_info_genrule")
 load("//tensorflow/core/platform:build_config.bzl", "pyx_library", "tf_additional_all_protos", "tf_additional_lib_deps", "tf_proto_library", "tf_proto_library_py", "tf_protos_grappler")  # @unused
-load("//tensorflow/core/platform:build_config_root.bzl", "if_static", "tf_additional_plugin_deps", "tf_additional_xla_deps_py")
+load("//tensorflow/core/platform:build_config_root.bzl", "if_static", "tf_additional_plugin_deps", "tf_additional_profiler_deps", "tf_additional_xla_deps_py")
 load("//tensorflow/python:build_defs.bzl", "tf_gen_op_wrapper_private_py")
 load(
     "//third_party/ngraph:build_defs.bzl",
@@ -6012,7 +6012,8 @@ pywrap_tensorflow_macro(
         "//tensorflow/core/util/tensor_bundle",
         "//tensorflow/compiler/mlir/python:mlir",
     ] + (tf_additional_lib_deps() +
-         tf_additional_plugin_deps()) + if_ngraph([
+         tf_additional_plugin_deps() +
+         tf_additional_profiler_deps()) + if_ngraph([
         "@ngraph_tf//:ngraph_tf",
     ]) + if_xla_available([
         "//tensorflow/compiler/aot:tfcompile_lib",