Update init.sh on win
This commit is contained in:
parent
3e74dab076
commit
49c964049d
|
@ -9,8 +9,14 @@ source "$BASE_DIR/common/echo.sh"
|
||||||
source "$BASE_DIR/common/detect.sh"
|
source "$BASE_DIR/common/detect.sh"
|
||||||
source "$BASE_DIR/common/host.sh"
|
source "$BASE_DIR/common/host.sh"
|
||||||
|
|
||||||
|
PYTHON="python"
|
||||||
|
if [ "$HOST_OS" = "Win" ]; then
|
||||||
|
# default python on MSYS
|
||||||
|
PYTHON="python2"
|
||||||
|
fi
|
||||||
|
|
||||||
_detect curl
|
_detect curl
|
||||||
_detect python
|
_detect $PYTHON
|
||||||
|
|
||||||
_install_deps() {
|
_install_deps() {
|
||||||
_cmd="$1"; shift; _deps_all=($@)
|
_cmd="$1"; shift; _deps_all=($@)
|
||||||
|
@ -56,7 +62,36 @@ elif [ "$HOST_OS" = "Mac" ]; then
|
||||||
# link clang-format-diff (if not compatible with Python 3, fix it by yourself)
|
# link clang-format-diff (if not compatible with Python 3, fix it by yourself)
|
||||||
[ -f "/usr/local/bin/clang-format-diff" ] || \
|
[ -f "/usr/local/bin/clang-format-diff" ] || \
|
||||||
ln -s /usr/local/share/clang/clang-format-diff.py /usr/local/bin/clang-format-diff
|
ln -s /usr/local/share/clang/clang-format-diff.py /usr/local/bin/clang-format-diff
|
||||||
# elif [ "$HOST_OS" = "Win" ]; then
|
elif [ "$HOST_OS" = "Win" ]; then
|
||||||
|
# detect pacman on MSYS
|
||||||
|
_detect pacman
|
||||||
|
# pacman install (common)
|
||||||
|
_install_deps "pacman -S" git clang-format
|
||||||
|
if [ "$HOST_NAME" = "MINGW" ]; then
|
||||||
|
# pacman install (MINGW)
|
||||||
|
_deps=()
|
||||||
|
if [ "$HOST_ARCH" = "x64" ]; then
|
||||||
|
_deps+=(mingw-w64-x86_64-toolchain mingw-w64-x86_64-cmake)
|
||||||
|
elif [ "$HOST_ARCH" = "x86" ]; then
|
||||||
|
_deps+=(mingw-w64-i686-toolchain mingw-w64-i686-cmake)
|
||||||
|
else
|
||||||
|
_echo_e "Unknown host arch :("
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
if ! [ ${#_deps[@]} -eq 0 ]; then
|
||||||
|
_echo_d "pacman -S ${_deps[*]}"
|
||||||
|
pacman -S ${_deps[@]}
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
# detect cmake on MSYS
|
||||||
|
_detect cmake
|
||||||
|
fi
|
||||||
|
# update
|
||||||
|
# pacman -Syu
|
||||||
|
# search
|
||||||
|
# pacman -Ss make
|
||||||
|
# autoremove
|
||||||
|
# pacman -Qtdq | pacman -Rs -
|
||||||
else # unexpected
|
else # unexpected
|
||||||
_echo_e "Unknown host os :("
|
_echo_e "Unknown host os :("
|
||||||
exit 1
|
exit 1
|
||||||
|
@ -68,7 +103,7 @@ fi
|
||||||
if ! _detect_cmd pip; then
|
if ! _detect_cmd pip; then
|
||||||
_echo_sn "Install pip"
|
_echo_sn "Install pip"
|
||||||
[ -f "get-pip.py" ] || curl -O https://bootstrap.pypa.io/get-pip.py
|
[ -f "get-pip.py" ] || curl -O https://bootstrap.pypa.io/get-pip.py
|
||||||
$SUDO python get-pip.py
|
$SUDO $PYTHON get-pip.py
|
||||||
fi
|
fi
|
||||||
# pip install
|
# pip install
|
||||||
_echo_d "pip install --upgrade autopep8 cpplint pylint requests"
|
_echo_d "pip install --upgrade autopep8 cpplint pylint requests"
|
||||||
|
@ -77,6 +112,6 @@ $SUDO pip install --upgrade autopep8 cpplint pylint requests
|
||||||
## init
|
## init
|
||||||
|
|
||||||
_echo_s "Init git hooks"
|
_echo_s "Init git hooks"
|
||||||
python "$ROOT_DIR/tools/linter/init-git-hooks.py"
|
$PYTHON "$ROOT_DIR/tools/linter/init-git-hooks.py"
|
||||||
|
|
||||||
exit 0
|
exit 0
|
||||||
|
|
Loading…
Reference in New Issue
Block a user