mirror of
https://codeberg.org/libreboot/lbmk.git
synced 2026-07-19 09:32:27 +02:00
init.sh: tidy up the python version check
Signed-off-by: Leah Rowe <leah@libreboot.org>
This commit is contained in:
+4
-7
@@ -60,11 +60,9 @@ xbmk_set_pyver()
|
|||||||
pybin "$python" 1>/dev/null || pyver=""
|
pybin "$python" 1>/dev/null || pyver=""
|
||||||
[ -z "$pyver" ] || "`pybin "$python"`" -c "$pyv" 1>/dev/null \
|
[ -z "$pyver" ] || "`pybin "$python"`" -c "$pyv" 1>/dev/null \
|
||||||
2>/dev/null || $err "Cannot detect host Python version."
|
2>/dev/null || $err "Cannot detect host Python version."
|
||||||
if [ -n "$pyver" ]; then
|
[ -n "$pyver" ] && \
|
||||||
pyver="$("$(pybin "$python")" -c "$pyv" | awk '{print $1}')"
|
pyver="$("$(pybin "$python")" -c "$pyv" | awk '{print $1}')" && \
|
||||||
pyver="${pyver#(}"
|
pyver="${pyver#(}" && pyver="${pyver%,}"
|
||||||
pyver="${pyver%,}"
|
|
||||||
fi
|
|
||||||
[ "${pyver%%.*}" = "3" ] || $err "Bad python version (must by 3.x)"; :
|
[ "${pyver%%.*}" = "3" ] || $err "Bad python version (must by 3.x)"; :
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -94,8 +92,7 @@ pybin()
|
|||||||
[ -e "$pypath/$1" ] && [ ! -d "$pypath/$1" ] && \
|
[ -e "$pypath/$1" ] && [ ! -d "$pypath/$1" ] && \
|
||||||
[ -x "$pypath/$1" ] && printf "%s/%s\n" "$pypath" "$1" && \
|
[ -x "$pypath/$1" ] && printf "%s/%s\n" "$pypath" "$1" && \
|
||||||
return 0
|
return 0
|
||||||
done
|
done && return 1
|
||||||
[ $venv -gt 0 ] && return 1
|
|
||||||
|
|
||||||
# Defer to normal command -v if not a venv
|
# Defer to normal command -v if not a venv
|
||||||
command -v "$1" 2>/dev/null || return 1
|
command -v "$1" 2>/dev/null || return 1
|
||||||
|
|||||||
Reference in New Issue
Block a user