diff --git a/tensorflow/tools/pip_package/build_pip_package.sh b/tensorflow/tools/pip_package/build_pip_package.sh index f35d0efcf15..dcf2615c679 100755 --- a/tensorflow/tools/pip_package/build_pip_package.sh +++ b/tensorflow/tools/pip_package/build_pip_package.sh @@ -184,11 +184,11 @@ function prepare_src() { # _sys.modules[__name__] as the argument of a function -- the last line in # the deprecation autogenerated pattern) # TODO(mihaimaruseac): When we move the API to root, remove this hack - # Note: Don't remove space between -i and "": Linux fails if you do as it - # tries to replace in "/_depre..." file, which is wrong. - sed -i"" \ + # Note: Can't do in place sed that works on all OS, so use a temp file instead + sed \ "/_deprecation_wrapper$/,/_sys.modules[__name__],/ d" \ - "${TMPDIR}/tensorflow_core/__init__.py" + "${TMPDIR}/tensorflow_core/__init__.py" > "${TMPDIR}/tensorflow_core/__init__.out" + mv "${TMPDIR}/tensorflow_core/__init__.out ${TMPDIR}/tensorflow_core/__init__.py" } function build_wheel() {