forked from openml/openml-python
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcreate_doc.sh
More file actions
61 lines (46 loc) · 1.79 KB
/
create_doc.sh
File metadata and controls
61 lines (46 loc) · 1.79 KB
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
# License: BSD 3-Clause
set -euo pipefail
# Check if DOCPUSH is set
if ! [[ -z ${DOCPUSH+x} ]]; then
if [[ "$DOCPUSH" == "true" ]]; then
# install documentation building dependencies
pip install matplotlib seaborn sphinx pillow sphinx-gallery sphinx_bootstrap_theme cython numpydoc nbformat nbconvert
# $1 is the branch name
# $2 is the global variable where we set the script status
if ! { [ $1 = "master" ] || [ $1 = "develop" ]; }; then
{ echo "Not one of the allowed branches"; exit 0; }
fi
# delete any previous documentation folder
if [ -d doc/$1 ]; then
rm -rf doc/$1
fi
# create the documentation
cd doc && make html 2>&1
# create directory with branch name
# the documentation for dev/stable from git will be stored here
mkdir $1
# get previous documentation from github
git clone https://github.com/openml/openml-python.git --branch gh-pages --single-branch
# copy previous documentation
cp -r openml-python/. $1
rm -rf openml-python
# if the documentation for the branch exists, remove it
if [ -d $1/$1 ]; then
rm -rf $1/$1
fi
# copy the updated documentation for this branch
mkdir $1/$1
cp -r build/html/. $1/$1
# takes a variable name as an argument and assigns the script outcome to a
# variable with the given name. If it got this far, the script was successful
function set_return() {
# $1 is the variable where we save the script outcome
local __result=$1
local status='success'
eval $__result="'$status'"
}
set_return "$2"
fi
fi
# Workaround for travis failure
set +u