8000 gh-120291: Fix a bashism in python-config.sh.in (#120292) · python/cpython@7d24471 · GitHub
[go: up one dir, main page]

Skip to content

Commit 7d24471

Browse files
authored
gh-120291: Fix a bashism in python-config.sh.in (#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 #120291
1 parent 141baba commit 7d24471

File tree

2 files changed

+6
-4
lines changed

2 files changed

+6
-4
lines changed
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Make the ``python-config`` shell script compatible with non-bash shells.

Misc/python-config.sh.in

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,12 @@
44

55
exit_with_usage ()
66
{
7-
local USAGE="Usage: $0 --prefix|--exec-prefix|--includes|--libs|--cflags|--ldflags|--extension-suffix|--help|--abiflags|--configdir|--embed"
8-
if [[ "$1" -eq 0 ]]; then
9-
echo "$USAGE"
7+
local usage
8+
usage="Usage: $0 --prefix|--exec-prefix|--includes|--libs|--cflags|--ldflags|--extension-suffix|--help|--abiflags|--configdir|--embed"
9+
if [ "$1" -eq 0 ]; then
10+
echo "$usage"
1011
else
11-
echo "$USAGE" >&2
12+
echo "$usage" >&2
1213
fi
1314
exit $1
1415
}

0 commit comments

Comments
 (0)
0