File size: 1,606 Bytes
2c3c408 | 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 66 67 68 69 70 71 72 73 74 75 76 | #!/bin/bash
#
# Builds the ReadTheDocs documentation locally.
# Usage. Execute in this directory:
# $ ./local-build.sh
# This creates a Python virtual env 'venv' in the current directory.
#
# Choose the default directories
source_dir="source"
build_dir="source/_build"
venv_dir="venv"
ext_dir="../"
die() {
echo "$@" 1>&2 ; popd 2>/dev/null; exit 1
}
arg() {
echo "$1" | sed "s/^${2-[^=]*=}//" | sed "s/:/;/g"
}
# Display bootstrap usage
usage() {
echo '
Usage: '"$0"' [<options>]
Options: [defaults in brackets after descriptions]
Configuration:
--help print this message
--tiledb=PATH (required) path to TileDB repo root
'
exit 10
}
# Parse arguments
tiledb=""
while test $# != 0; do
case "$1" in
--tiledb=*) dir=`arg "$1"`
tiledb="$dir";;
--help) usage ;;
*) die "Unknown option: $1" ;;
esac
shift
done
if [ ! -d "${tiledb}" ]; then
die "invalid tiledb installation directory (use --tiledb)"
fi
build_ext() {
pushd "${ext_dir}"
TILEDB_PATH=${tiledb} pip install .[doc] || die "could not install tiledb-py"
popd
}
build_site() {
if [[ $OSTYPE == darwin* ]]; then
export DYLD_LIBRARY_PATH="${tiledb}/lib"
else
export LD_LIBRARY_PATH="${tiledb}/lib"
fi
export TILEDB_PY_NO_VERSION_CHECK="yes"
sphinx-build -E -T -b html -d ${build_dir}/doctrees -D language=en ${source_dir} ${build_dir}/html || \
die "could not build sphinx site"
}
run() {
build_ext
build_site
echo "Build complete. Open '${build_dir}/html/index.html' in your browser."
}
run
|