Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit 8ed25ed

Browse files
eli-schwartzcodebytere
authored andcommittedJun 18, 2020
build: fix inability to detect correct python command in configure
The "which" utility is not guaranteed to be installed, and if it is, its behavior is not portable. Conversely, the "command -v" shell builtin is required to exist in all POSIX 2008 compliant shells, and is thus guaranteed to work everywhere. Examples of open-source shells likely to be installed as /bin/sh on Linux, which implement the 12-year-old standard: ash, bash, busybox, dash, ksh, mksh and zsh. Signed-off-by: Eli Schwartz <[email protected]> PR-URL: #32925 Reviewed-By: Richard Lau <[email protected]> Reviewed-By: Matheus Marchini <[email protected]> Reviewed-By: Ruben Bridgewater <[email protected]>
1 parent 8b887c4 commit 8ed25ed

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed
 

‎configure

+5-5
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,11 @@
55
# as is the fact that the ] goes on a new line.
66
_=[ 'exec' '/bin/sh' '-c' '''
77
test ${FORCE_PYTHON2} && exec python2 "$0" "$@" # workaround for gclient
8-
which python3.8 >/dev/null && exec python3.8 "$0" "$@"
9-
which python3.7 >/dev/null && exec python3.7 "$0" "$@"
10-
which python3.6 >/dev/null && exec python3.6 "$0" "$@"
11-
which python3.5 >/dev/null && exec python3.5 "$0" "$@"
12-
which python2.7 >/dev/null && exec python2.7 "$0" "$@"
8+
command -v python3.8 >/dev/null && exec python3.8 "$0" "$@"
9+
command -v python3.7 >/dev/null && exec python3.7 "$0" "$@"
10+
command -v python3.6 >/dev/null && exec python3.6 "$0" "$@"
11+
command -v python3.5 >/dev/null && exec python3.5 "$0" "$@"
12+
command -v python2.7 >/dev/null && exec python2.7 "$0" "$@"
1313
exec python "$0" "$@"
1414
''' "$0" "$@"
1515
]

0 commit comments

Comments
 (0)
Please sign in to comment.