summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--include/lib.sh8
1 files changed, 7 insertions, 1 deletions
diff --git a/include/lib.sh b/include/lib.sh
index 894a2cac..b43d83f3 100644
--- a/include/lib.sh
+++ b/include/lib.sh
@@ -82,7 +82,13 @@ pyver="2"
python="python3"
command -v python3 1>/dev/null || python="python"
command -v $python 1>/dev/null || pyver=""
-[ -n "$pyver" ] && pyver="$($python --version | awk '{print $2}')"
+[ -z "$pyver" ] || \
+ python -c 'import sys; print(sys.version_info[:])' 1>/dev/null \
+ 2>/dev/null || $err "Cannot determine which Python version."
+[ -n "$pyver" ] && \
+ pyver="`python -c 'import sys; print(sys.version_info[:])' | \
+ awk '{print $1}'`" && \
+ pyver="${pyver#(}" && pyver="${pyver%,}"
if [ "${pyver%%.*}" != "3" ]; then
printf "Wrong python version, or python missing. Must be v 3.x.\n" 1>&2
exit 1