Make python optional in init.sh

This commit is contained in:
John Zhao 2018-06-12 10:22:15 +08:00
parent 40b7acd5c3
commit 3e42060ff1

View File

@ -28,7 +28,12 @@ if [ "$HOST_OS" = "Win" ]; then
PYTHON="python2" PYTHON="python2"
fi fi
_detect $PYTHON _detect $PYTHON 1
PYTHON_FOUND="${PYTHON}_FOUND"
if [ -z "${!PYTHON_FOUND}" ]; then
_echo_en "$PYTHON not found"
fi
if [ "$HOST_OS" = "Linux" ]; then if [ "$HOST_OS" = "Linux" ]; then
_detect_install() { _detect_install() {
@ -137,13 +142,21 @@ fi
# detect pip # detect pip
if ! _detect_cmd pip; then if ! _detect_cmd pip; then
_echo_sn "Install pip" if [ -n "${!PYTHON_FOUND}" ]; then
[ -f "get-pip.py" ] || curl -O https://bootstrap.pypa.io/get-pip.py _echo_sn "Install pip"
$SUDO $PYTHON get-pip.py [ -f "get-pip.py" ] || curl -O https://bootstrap.pypa.io/get-pip.py
$SUDO $PYTHON get-pip.py
else
_echo_en "Skipped install pip, as $PYTHON not found"
fi
fi fi
# pip install # pip install
_echo_d "pip install --upgrade autopep8 cpplint pylint requests" if _detect_cmd pip; then
$SUDO pip install --upgrade autopep8 cpplint pylint requests _echo_d "pip install --upgrade autopep8 cpplint pylint requests"
$SUDO pip install --upgrade autopep8 cpplint pylint requests
else
_echo_en "Skipped pip install packages, as pip not found"
fi
## realpath ## realpath
@ -168,8 +181,12 @@ ROOT_DIR=$(realpath "$BASE_DIR/..")
## init ## init
_echo_s "Init git hooks" if [ -n "${!PYTHON_FOUND}" ]; then
$PYTHON "$ROOT_DIR/tools/linter/init-git-hooks.py" _echo_s "Init git hooks"
$PYTHON "$ROOT_DIR/tools/linter/init-git-hooks.py"
else
_echo_en "Skipped init git hooks, as $PYTHON not found"
fi
## cmake version ## cmake version