From 93ebb3fb4abefdfbcd39d07f27660d52c418e8a9 Mon Sep 17 00:00:00 2001 From: Mihai Maruseac Date: Mon, 17 Jun 2019 10:52:03 -0700 Subject: [PATCH] Use temporary file instead of inplace sed while making the virtual pip This should fix Macos and Linux jobs using an equivalent stanza for both. PiperOrigin-RevId: 253613917 --- tensorflow/tools/pip_package/build_pip_package.sh | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) 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() {