From 74dc6aa56ca07766c9d086fd14eae8af271322fd Mon Sep 17 00:00:00 2001 From: lian Date: Fri, 25 Mar 2022 15:38:02 +0800 Subject: [PATCH] update seahub.sh make Seafile be compatible with Python 3.10 --- scripts/seahub.sh | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/scripts/seahub.sh b/scripts/seahub.sh index 205d003c9f..224fff5184 100755 --- a/scripts/seahub.sh +++ b/scripts/seahub.sh @@ -57,14 +57,20 @@ function check_python_executable() { if which python3 2>/dev/null 1>&2; then PYTHON=python3 - elif !(python --version 2>&1 | grep "3\.[0-9]\.[0-9]") 2>/dev/null 1>&2; then + elif !(python --version 2>&1 | grep "3\.[0-9]\+\.[0-9]\+") 2>/dev/null 1>&2; then echo echo "The current version of python is not 3.x.x, please use Python 3.x.x ." echo exit 1 else + # Python 3.8.10 PYTHON="python"$(python --version | cut -b 8-10) - if !which $PYTHON 2>/dev/null 1>&2; then + + if !(which $PYTHON) 2>/dev/null 1>&2; then + # Python 3.10.4 + PYTHON="python"$(python --version | cut -b 8-11) + fi + if !(which $PYTHON) 2>/dev/null 1>&2; then echo echo "Can't find a python executable of $PYTHON in PATH" echo "Install $PYTHON before continue."