8000 Determine the version of sed based on the output of "--version" rathe… · staticfloat/tensorflow@14221c1 · GitHub
[go: up one dir, main page]

Skip to content

Commit 14221c1

Browse files
Determine the version of sed based on the output of "--version" rather than ${OSTYPE}. The later approach is not reliable when an user installed GNU sed in Darwin systems like macOS.
PiperOrigin-RevId: 155822030
1 parent 5f9facb commit 14221c1

Fil EB5C e tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

tensorflow/contrib/makefile/download_dependencies.sh

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,9 +30,13 @@ RE2_URL="$(grep -o 'http.*github.com/google/re2/.*tar\.gz' "${BZL_FILE_PATH}" |
3030
replace_by_sed() {
3131
local regex="${1}"
3232
shift
33-
if echo "${OSTYPE}" | grep -q darwin; then
33+
# Detect the version of sed by the return value of "--version" flag. GNU-sed
34+
# supports "--version" while BSD-sed doesn't.
35+
if ! sed --version >/dev/null 2>&1; then
36+
# BSD-sed.
3437
sed -i '' -e "${regex}" "$@"
3538
else
39+
# GNU-sed.
3640
sed -i -e "${regex}" "$@"
3741
fi
3842
}

0 commit comments

Comments
 (0)
0