1
0
mirror of https://github.com/haiwen/seafile-server.git synced 2025-09-14 06:12:50 +00:00

Modify check python executable in scripts.

This commit is contained in:
ly1217
2019-11-26 18:37:47 -08:00
parent 88a573893a
commit 50502cf7bb
4 changed files with 52 additions and 44 deletions

View File

@@ -11,13 +11,14 @@ function check_python_executable() {
return 0 return 0
fi fi
if !(python --version 2>&1 | grep "3\.[0-9]\.[0-9]") 2>/dev/null 1>&2; then 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
echo echo
echo "The current version of python is not 3.x.x, please use Python 3.x.x ." echo "The current version of python is not 3.x.x, please use Python 3.x.x ."
echo echo
exit 1 exit 1
fi else
PYTHON="python"$(python --version | cut -b 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
echo echo
@@ -27,6 +28,7 @@ function check_python_executable() {
echo echo
exit 1 exit 1
fi fi
fi
} }
function read_seafile_data_dir () { function read_seafile_data_dir () {

View File

@@ -51,13 +51,14 @@ function check_python_executable() {
return 0 return 0
fi fi
if !(python --version 2>&1 | grep "3\.[0-9]\.[0-9]") 2>/dev/null 1>&2; then 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
echo echo
echo "The current version of python is not 3.x.x, please use Python 3.x.x ." echo "The current version of python is not 3.x.x, please use Python 3.x.x ."
echo echo
exit 1 exit 1
fi else
PYTHON="python"$(python --version | cut -b 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
echo echo
@@ -67,6 +68,7 @@ function check_python_executable() {
echo echo
exit 1 exit 1
fi fi
fi
} }
function validate_ccnet_conf_dir () { function validate_ccnet_conf_dir () {

View File

@@ -23,13 +23,14 @@ function check_python_executable() {
return 0 return 0
fi fi
if !(python --version 2>&1 | grep "3\.[0-9]\.[0-9]") 2>/dev/null 1>&2; then 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
echo echo
echo "The current version of python is not 3.x.x, please use Python 3.x.x ." echo "The current version of python is not 3.x.x, please use Python 3.x.x ."
echo echo
err_and_quit err_and_quit
fi else
PYTHON="python"$(python --version | cut -b 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
echo echo
@@ -39,6 +40,7 @@ function check_python_executable() {
echo echo
err_and_quit err_and_quit
fi fi
fi
} }
function check_python () { function check_python () {

View File

@@ -95,13 +95,14 @@ function check_python_executable() {
return 0 return 0
fi fi
if !(python --version 2>&1 | grep "3\.[0-9]\.[0-9]") 2>/dev/null 1>&2; then 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
echo echo
echo "The current version of python is not 3.x.x, please use Python 3.x.x ." echo "The current version of python is not 3.x.x, please use Python 3.x.x ."
echo echo
err_and_quit err_and_quit
fi else
PYTHON="python"$(python --version | cut -b 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
echo echo
@@ -111,6 +112,7 @@ function check_python_executable() {
echo echo
err_and_quit err_and_quit
fi fi
fi
echo "Find python: $PYTHON" echo "Find python: $PYTHON"
echo echo