-
Notifications
You must be signed in to change notification settings - Fork 9
Expand file tree
/
Copy pathbuild_docs.sh
More file actions
executable file
·40 lines (32 loc) · 1.03 KB
/
build_docs.sh
File metadata and controls
executable file
·40 lines (32 loc) · 1.03 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
#!/bin/bash
cd $(dirname $0)
set -e
set -x
branch=$1
output=$2
venv_dir="./build/venv"
repo_dir="./build/bottle.git"
build_dir="./build/docs/"
mkdir -p "$build_dir"
test -d "$venv_dir" || python3 -mvenv "$venv_dir"
source "$venv_dir/bin/activate"
pip install -r requirements.txt
test -d $repo_dir || git clone https://github.com/bottlepy/bottle.git $repo_dir
pushd "$repo_dir"
git fetch origin
git switch --detach --force "origin/$branch"
git clean -d -x -f
test -d apidocs && cd apidocs || cd docs
docs_dir=`pwd`
popd
rm -rf $build_dir/$branch/html/*
mkdir -p $build_dir/$branch/html
if [ "$output" == "--watch" ]; then
PYTHONPATH=$repo_dir sphinx-autobuild -E -c sphinx -b html $docs_dir $build_dir/$branch/html
else
PYTHONPATH=$repo_dir sphinx-build -E -q -c sphinx -b html $docs_dir $build_dir/$branch/html
cp $repo_dir/bottle.py $build_dir/$branch/html
# We rsync to keep mtime on unchanged files. Good for HTTP caching.
mkdir -p "$output"
rsync -vrc --exclude .doctrees --delete $build_dir/$branch/html/ "$output"
fi