加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
build-docs.sh 1.61 KB
一键复制 编辑 原始数据 按行查看 历史
kanag 提交于 2021-08-10 07:23 . Fix build script
#!/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
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化