Skip to content

Commit 15f568e

Browse files
Merge PR jakovius#15: Remove hard coded python versions and use >= instead
2 parents cb4a89d + 8f3df0a commit 15f568e

File tree

1 file changed

+13
-10
lines changed

1 file changed

+13
-10
lines changed

packaging/voxd.wrapper

Lines changed: 13 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -44,10 +44,12 @@ print(f"{sys.version_info.major}.{sys.version_info.minor}")
4444
PY
4545
)"
4646
log "System Python version: $ver"
47-
case "$ver" in
48-
3.9|3.10|3.11|3.12|3.13) : ;;
49-
*)
50-
# Attempt to create a user-local venv with any newer Python found
47+
# Check if version is >= 3.9
48+
IFS='.' read -r major minor <<< "$ver"
49+
if [[ "$major" -gt 3 ]] || [[ "$major" -eq 3 && "$minor" -ge 9 ]]; then
50+
: # version is acceptable
51+
else
52+
# Attempt to create a user-local venv with any newer Python found
5153
pick_python() {
5254
for c in python3.12 python3.11 python3.10 python3.9 python3; do
5355
if command -v "$c" >/dev/null 2>&1; then
@@ -56,10 +58,12 @@ import sys
5658
print(f"{sys.version_info.major}.{sys.version_info.minor}")
5759
PY
5860
)"
59-
case "$v" in
60-
3.9|3.10|3.11|3.12|3.13) echo "$c"; return 0 ;;
61-
*) : ;;
62-
esac
61+
# Check if version is >= 3.9
62+
IFS='.' read -r v_major v_minor <<< "$v"
63+
if [[ "$v_major" -gt 3 ]] || [[ "$v_major" -eq 3 && "$v_minor" -ge 9 ]]; then
64+
echo "$c"
65+
return 0
66+
fi
6367
fi
6468
done
6569
echo ""
@@ -86,8 +90,7 @@ PY
8690
echo "[voxd] System Python $ver is unsupported and no newer Python was found. Use 'bash packaging/install_voxd.sh <rpm>' to provision a newer Python, or create $APPDIR/.venv with Python >= 3.9." >&2
8791
exit 1
8892
fi
89-
;;
90-
esac
93+
fi
9194
fi
9295

9396
# Ensure Python can import the embedded source tree

0 commit comments

Comments
 (0)