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:
@@ -11,21 +11,23 @@ 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
|
echo "Can't find a python executable of $PYTHON in PATH"
|
||||||
echo "Can't find a python executable of $PYTHON in PATH"
|
echo "Install $PYTHON before continue."
|
||||||
echo "Install $PYTHON before continue."
|
echo "Or if you installed it in a non-standard PATH, set the PYTHON enviroment varirable to it"
|
||||||
echo "Or if you installed it in a non-standard PATH, set the PYTHON enviroment varirable to it"
|
echo
|
||||||
echo
|
exit 1
|
||||||
exit 1
|
fi
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -51,21 +51,23 @@ 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
|
echo "Can't find a python executable of $PYTHON in PATH"
|
||||||
echo "Can't find a python executable of $PYTHON in PATH"
|
echo "Install $PYTHON before continue."
|
||||||
echo "Install $PYTHON before continue."
|
echo "Or if you installed it in a non-standard PATH, set the PYTHON enviroment varirable to it"
|
||||||
echo "Or if you installed it in a non-standard PATH, set the PYTHON enviroment varirable to it"
|
echo
|
||||||
echo
|
exit 1
|
||||||
exit 1
|
fi
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -23,21 +23,23 @@ 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
|
echo "Can't find a python executable of $PYTHON in PATH"
|
||||||
echo "Can't find a python executable of $PYTHON in PATH"
|
echo "Install $PYTHON before continue."
|
||||||
echo "Install $PYTHON before continue."
|
echo "Or if you installed it in a non-standard PATH, set the PYTHON enviroment varirable to it"
|
||||||
echo "Or if you installed it in a non-standard PATH, set the PYTHON enviroment varirable to it"
|
echo
|
||||||
echo
|
err_and_quit
|
||||||
err_and_quit
|
fi
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -95,21 +95,23 @@ 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
|
echo "Can't find a python executable of $PYTHON in PATH"
|
||||||
echo "Can't find a python executable of $PYTHON in PATH"
|
echo "Install $PYTHON before continue."
|
||||||
echo "Install $PYTHON before continue."
|
echo "Or if you installed it in a non-standard PATH, set the PYTHON enviroment varirable to it"
|
||||||
echo "Or if you installed it in a non-standard PATH, set the PYTHON enviroment varirable to it"
|
echo
|
||||||
echo
|
err_and_quit
|
||||||
err_and_quit
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
echo "Find python: $PYTHON"
|
echo "Find python: $PYTHON"
|
||||||
|
Reference in New Issue
Block a user