https://github.com/python/cpython/commit/7d2447137e117ea9a6ee1493bce0b071c76b1bd7
commit: 7d2447137e117ea9a6ee1493bce0b071c76b1bd7
branch: main
author: Michał Górny <[email protected]>
committer: sobolevn <[email protected]>
date: 2024-06-11T10:11:13+03:00
summary:

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

files:
A Misc/NEWS.d/next/Build/2024-06-09-15-54-22.gh-issue-120291.IpfHzE.rst
M Misc/python-config.sh.in

diff --git 
a/Misc/NEWS.d/next/Build/2024-06-09-15-54-22.gh-issue-120291.IpfHzE.rst 
b/Misc/NEWS.d/next/Build/2024-06-09-15-54-22.gh-issue-120291.IpfHzE.rst
new file mode 100644
index 00000000000000..d0bb297b51dc6e
--- /dev/null
+++ b/Misc/NEWS.d/next/Build/2024-06-09-15-54-22.gh-issue-120291.IpfHzE.rst
@@ -0,0 +1 @@
+Make the ``python-config`` shell script compatible with non-bash shells.
diff --git a/Misc/python-config.sh.in b/Misc/python-config.sh.in
index c3c0b34fc1451d..9929f5b2653dca 100644
--- a/Misc/python-config.sh.in
+++ b/Misc/python-config.sh.in
@@ -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
 }

_______________________________________________
Python-checkins mailing list -- [email protected]
To unsubscribe send an email to [email protected]
https://mail.python.org/mailman3/lists/python-checkins.python.org/
Member address: [email protected]

Reply via email to