forked from lutzroeder/netron
-
Notifications
You must be signed in to change notification settings - Fork 0
/
sklearn
executable file
·65 lines (57 loc) · 1.75 KB
/
sklearn
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
#!/bin/bash
set -e
pushd $(cd $(dirname ${0})/..; pwd) > /dev/null
case "${OSTYPE}" in
msys*) python="winpty python";;
*) python="python";;
esac
venv() {
env_dir=./third_party/env/scikit-learn
[ -d "${env_dir}" ] || ${python} -m venv ${env_dir}
case "${OSTYPE}" in
msys*) source ${env_dir}/Scripts/activate;;
*) source ${env_dir}/bin/activate;;
esac
${python} -m pip install --quiet --upgrade pip setuptools wheel
}
clean() {
echo "sklearn clean"
rm -rf "./third_party/env/scikit-learn"
rm -rf "./third_party/source/scikit-learn"
}
sync() {
echo "sklearn sync"
[ -d "./third_party/source/scikit-learn" ] || git clone --quiet --recursive "https://github.com/scikit-learn/scikit-learn.git" "./third_party/source/scikit-learn"
pushd "./third_party/source/scikit-learn" > /dev/null
git pull --quiet --prune
git submodule sync --quiet
git submodule update --quiet --init --recursive
popd > /dev/null
}
install() {
echo "sklearn install"
venv
${python} -m pip install --quiet scipy
${python} -m pip install --quiet --pre --extra-index https://pypi.anaconda.org/scipy-wheels-nightly/simple scikit-learn
deactivate
}
metadata() {
echo "sklearn metadata"
[[ $(grep -U $'\x0D' ./source/sklearn-metadata.json) ]] && crlf=1
venv
export PROTOCOL_BUFFERS_PYTHON_IMPLEMENTATION=python
${python} ./tools/sklearn_metadata.py
deactivate
if [[ -n ${crlf} ]]; then
unix2dos --quiet --newfile ./source/sklearn-metadata.json ./source/sklearn-metadata.json
fi
}
while [ "$#" != 0 ]; do
command="$1" && shift
case "${command}" in
"clean") clean;;
"sync") sync;;
"install") install;;
"metadata") metadata;;
esac
done