[3.13] gh-120291: Fix a bashism in python-config.sh.in (GH-120292) (#120341)

gh-120291: Fix a bashism in python-config.sh.in (GH-120292)

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 GH-120291
(cherry picked from commit 7d2447137e)

Co-authored-by: Michał Górny <mgorny@gentoo.org>
This commit is contained in:
Miss Islington (bot) 2024-06-11 09:29:01 +02:00 committed by GitHub
parent 52225c64f7
commit 7993268beb
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 6 additions and 4 deletions

View File

@ -0,0 +1 @@
Make the ``python-config`` shell script compatible with non-bash shells.

View File

@ -4,11 +4,12 @@
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
}