X-Git-Url: https://gerrit.opnfv.org/gerrit/gitweb?a=blobdiff_plain;f=scripts%2Fdocs-build.sh;h=7d8abf1ca6579de19c38154b2375752085c9ade8;hb=3c352781db97c06468f3910834588ed727ad3725;hp=afa68ec65199fa964041750a44b28626bbb94ee1;hpb=f59a2d4f1c5655e5ec4f3ab5fe70932ac2fa94f0;p=opnfvdocs.git diff --git a/scripts/docs-build.sh b/scripts/docs-build.sh index afa68ec65..7d8abf1ca 100755 --- a/scripts/docs-build.sh +++ b/scripts/docs-build.sh @@ -110,6 +110,8 @@ function prepare_config() { _name="$2" _conf="$_src/conf.py" + touch "$_conf" + # default params # Note: If you want to add a new sphinx extention here, you may need python # package for it (e.g. python package 'sphinxcontrib-httpdomain' is @@ -126,6 +128,10 @@ function prepare_config() { add_config "$_conf" 'html_logo' "'opnfv-logo.png'" add_config "$_conf" 'latex_domain_indices' "False" add_config "$_conf" 'latex_logo' "'opnfv-logo.png'" + add_config "$_conf" 'html_sidebars' \ + "{'**': ['globaltoc.html', + '$(cd $OPNFVDOCS_DIR; pwd)/etc/pagemenu.html', + 'searchbox.html']}" # genarated params title=$(cd $_src; python -c "$get_title_script") @@ -173,30 +179,36 @@ function generate_name() { } -check_rst_doc $DOCS_DIR - if [[ ! -d "$OPNFVDOCS_DIR" ]] ; then echo "Error: $OPNFVDOCS_DIR dir not found." echo "See http://artifacts.opnfv.org/opnfvdocs/docs/how-to-use-docs ." exit 1 fi -prepare_src_files - if ! which virtualenv > /dev/null ; then echo "Error: 'virtualenv' not found. Exec 'sudo pip install virtualenv' first." exit 1 fi -virtualenv "$VENV_DIR" +# workaround for doc8 error in python2.6 +if [[ $(python -V 2>&1) == Python\ 2.6.* ]] && [ -e /usr/bin/python2.7 ]; then + echo "creating venv with Python 2.7 instead of Python 2.6.x ..." + virtualenv "$VENV_DIR" --python=/usr/bin/python2.7 +else + virtualenv "$VENV_DIR" +fi + source "$VENV_DIR/bin/activate" +pip install -r "$OPNFVDOCS_DIR/etc/requirements.txt" + +check_rst_doc $DOCS_DIR + +prepare_src_files if [ -e "$DOCS_DIR/pre-hook.sh" ]; then source "$DOCS_DIR/pre-hook.sh" fi -pip install -r "$OPNFVDOCS_DIR/etc/requirements.txt" - find $DOCS_DIR -name $INDEX_RST -printf '%h\n' | while read dir do name=$(generate_name $dir) @@ -221,6 +233,18 @@ do sphinx-build -b html -t html -E "$src" "$output" + { + sphinx-build -b singlehtml -t singlehtml -E "$src" "${output}-single" + } || { + msg="Error: Single HTML creation for $dir has failed." + echo + echo "$msg" + echo + if [ -n "$GERRIT_COMMENT" ]; then + echo "$msg" >> "$GERRIT_COMMENT" + fi + } + # Note: PDF creation may fail in project doc builds. # We allow this build job to be marked as succeeded with # failure in PDF creation, but leave message to fix it.