gh-120291: Fix bashisms in python-config.sh.in
Replace the use of bash-specific `[[ ... ]]` with POSIX-compliant
`[ ... ]` to make the `python-config` shell script work with non-bash
shells again. While at it, use `local` in a safer way, since it is
not in POSIX either (though universally supported).
Fixes #120291
--- /dev/null
+Make the ``python-config`` shell script compatible with non-bash shells.
exit_with_usage ()
{
- local USAGE="Usage: $0 --prefix|--exec-prefix|--includes|--libs|--cflags|--ldflags|--extension-suffix|--help|--abiflags|--configdir|--embed"
- if [[ "$1" -eq 0 ]]; then
- echo "$USAGE"
+ local usage
+ usage="Usage: $0 --prefix|--exec-prefix|--includes|--libs|--cflags|--ldflags|--extension-suffix|--help|--abiflags|--configdir|--embed"
+ if [ "$1" -eq 0 ]; then
+ echo "$usage"
else
- echo "$USAGE" >&2
+ echo "$usage" >&2
fi
exit $1
}