summaryrefslogtreecommitdiff
path: root/include/init.sh
diff options
context:
space:
mode:
authorLeah Rowe <leah@libreboot.org>2025-05-04 08:47:12 +0100
committerLeah Rowe <leah@libreboot.org>2025-05-04 08:47:12 +0100
commit6e447876cca283434163328ce08b6e9d0b5a1d24 (patch)
tree50447d14cc145c058f5705016bc47de7bbe3bb9f /include/init.sh
parent7392f6fc8ecbff10661be6ae66306afd89f1a3e3 (diff)
init.sh: tidy up the python version check
Signed-off-by: Leah Rowe <leah@libreboot.org>
Diffstat (limited to 'include/init.sh')
-rw-r--r--include/init.sh11
1 files changed, 4 insertions, 7 deletions
diff --git a/include/init.sh b/include/init.sh
index 4807e1cf..9f6e7162 100644
--- a/include/init.sh
+++ b/include/init.sh
@@ -60,11 +60,9 @@ xbmk_set_pyver()
pybin "$python" 1>/dev/null || pyver=""
[ -z "$pyver" ] || "`pybin "$python"`" -c "$pyv" 1>/dev/null \
2>/dev/null || $err "Cannot detect host Python version."
- if [ -n "$pyver" ]; then
- pyver="$("$(pybin "$python")" -c "$pyv" | awk '{print $1}')"
- pyver="${pyver#(}"
- pyver="${pyver%,}"
- fi
+ [ -n "$pyver" ] && \
+ pyver="$("$(pybin "$python")" -c "$pyv" | awk '{print $1}')" && \
+ pyver="${pyver#(}" && pyver="${pyver%,}"
[ "${pyver%%.*}" = "3" ] || $err "Bad python version (must by 3.x)"; :
}
@@ -94,8 +92,7 @@ pybin()
[ -e "$pypath/$1" ] && [ ! -d "$pypath/$1" ] && \
[ -x "$pypath/$1" ] && printf "%s/%s\n" "$pypath" "$1" && \
return 0
- done
- [ $venv -gt 0 ] && return 1
+ done && return 1
# Defer to normal command -v if not a venv
command -v "$1" 2>/dev/null || return 1