| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970 |
- #!/bin/bash
- set -e
- root=$(cd $(dirname ${0})/..; pwd)
- virtualenv=${root}/build/virtualenv/scikit-learn
- tools=${root}/tools
- third_party=${root}/third_party
- if [ $(which python3) ] && [ $(which pip3) ]; then
- python="python3"
- pip="pip3"
- else
- python="python"
- pip="pip"
- fi
- bold() {
- echo "$(tty -s && tput bold)$1$(tty -s && tput sgr0)"
- }
- git_sync() {
- mkdir -p "${third_party}"
- if [ -d "${third_party}/${1}" ]; then
- git -C "${third_party}/${1}" fetch --quiet -p
- git -C "${third_party}/${1}" reset --quiet --hard origin/master
- else
- echo "Clone ${2}..."
- git -C "${third_party}" clone --quiet --recursive ${2} ${1}
- fi
- git -C "${third_party}" submodule update --quiet --init
- }
- sync() {
- bold "sklearn clean"
- git_sync numpy https://github.com/numpy/numpy.git
- git_sync scikit-learn https://github.com/scikit-learn/scikit-learn.git
- git_sync lightgbm https://github.com/Microsoft/LightGBM.git
- git_sync xgboost https://github.com/dmlc/xgboost.git
- }
- install() {
- bold "sklearn install"
- if [ ! -d "${virtualenv}" ]; then
- virtualenv --quiet -p ${python} ${virtualenv}
- fi
- source ${virtualenv}/bin/activate
- ${pip} install --quiet Cython
- ${pip} install --quiet numpy
- ${pip} install --quiet ${third_party}/scikit-learn
- deactivate
- }
- metadata() {
- bold "sklearn metadata"
- source ${virtualenv}/bin/activate
- pushd ${tools} > /dev/null
- ${python} sklearn-script.py
- popd > /dev/null
- deactivate
- }
- while [ "$#" != 0 ]; do
- command="$1" && shift
- case "${command}" in
- "sync") sync;;
- "install") install;;
- "metadata") metadata;;
- esac
- done
|