-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbuild-docs.sh
More file actions
executable file
·63 lines (49 loc) · 1.61 KB
/
build-docs.sh
File metadata and controls
executable file
·63 lines (49 loc) · 1.61 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
62
63
#!/bin/bash
# Local build verification
if [[ -z "$BUILD_NUMBER" ]]; then
echo "Set BUILD_NUMBER env var"
exit 1
fi
# Common function for exit function
exit_if_error() {
local exit_code=$1
shift
[[ $exit_code ]] &&
((exit_code != 0)) && {
printf 'ERROR: %s\n' "$@" >&2
}
}
# Common clean up function
cleanup() {
rm -rf ~/docs_jjb
}
# cleanup and create a virtual python directory for docs command executions.
cleanup
mkdir -p ~/docs_jjb/virtualpython
virtualenv -p /usr/bin/python3 ~/docs_jjb/virtualpython
source ~/docs_jjb/virtualpython/bin/activate
exit_if_error $? "Unable to activate virtual python."
# Tool installation and html generation
pip install sphinx
exit_if_error $? "sphinx installation failed."
pip install recommonmark
exit_if_error $? "recommonmark installation failed."
pip install sphinx_markdown_tables
exit_if_error $? "sphinx_rtd_theme installation failed."
sphinx_markdown_tables
pip install sphinx_rtd_theme
exit_if_error $? "sphinx_rtd_theme installation failed."
pip install -r requirements.txt
exit_if_error $? "Running requirements.txt failed."
make html
exit_if_error $? "Unable to generate Chinese HTML documents."
sphinx-build -b gettext . _build/gettext
exit_if_error $? "Unable to generate .pot documents."
sphinx-intl update -p _build/gettext -l en --line-width=99999999999999999999
exit_if_error $? "Unable to generate .po documents."
sphinx-build -b html -D language=en . _build/html/en
exit_if_error $? "Unable to generate English HTML documents."
mkdir -p /var/www/html/$BUILD_NUMBER
cp -r _build/html/en/* /var/www/html/$BUILD_NUMBER/
# Cleanup and exit
cleanup