diff --git a/doc-tools-check-languages.conf b/doc-tools-check-languages.conf new file mode 100644 index 0000000000..0077810dc3 --- /dev/null +++ b/doc-tools-check-languages.conf @@ -0,0 +1,20 @@ +# Example configuration for the languages 'ja' and 'fr'. + +# directories to be set up +declare -A DIRECTORIES=( + ["ja"]="common glossary high-availability-guide image-guide install-guide user-guide user-guide-admin" + ["fr"]="common glossary user-guide" +) + +# books to be built +declare -A BOOKS=( + ["ja"]="high-availability-guide image-guide install-guide user-guide user-guide-admin" + ["fr"]="user-guide" +) + +# Where does the top-level pom live? +# Set to empty to not copy it. +POM_FILE="doc/pom.xml" + +# Location of doc dir +DOC_DIR="doc/" diff --git a/test-requirements.txt b/test-requirements.txt index fe40eb98de..cbbbd8483f 100644 --- a/test-requirements.txt +++ b/test-requirements.txt @@ -1,4 +1,4 @@ Jinja2 -openstack-doc-tools>=0.17 +openstack-doc-tools>=0.18.1 sphinx>=1.1.2,!=1.2.0,<1.3 oslosphinx diff --git a/tools/test-languages.sh b/tools/test-languages.sh deleted file mode 100755 index 6aea79963a..0000000000 --- a/tools/test-languages.sh +++ /dev/null @@ -1,130 +0,0 @@ -#!/bin/bash - -function setup_directory { - SET_LANG=$1 - shift - for BOOK_DIR in "$@" ; do - echo " $BOOK_DIR" - openstack-generate-docbook -l $SET_LANG -b $BOOK_DIR - done -} - - -function setup_lang { - SET_LANG=$1 - shift - echo "Setting up files for $SET_LANG" - echo "=======================" - echo " Directories:" - setup_directory $SET_LANG 'common' 'glossary' "$@" - cp doc/pom.xml generated/$SET_LANG/pom.xml -} - -function test_fr { - setup_lang 'fr' - - setup_directory 'fr' 'common' 'glossary' 'user-guide' - case "$PURPOSE" in - test) - openstack-doc-test -v --check-build -l fr \ - --only-book user-guide - RET=$? - ;; - publish) - openstack-doc-test -v --publish --check-build -l fr \ - --only-book user-guide - RET=$? - ;; - esac - if [ "$RET" -eq "0" ] ; then - echo "... succeeded" - else - echo "... failed" - BUILD_FAIL=1 - fi -} - - -function test_ja { - setup_lang 'ja' - - setup_directory 'ja' 'high-availability-guide' \ - 'image-guide' 'install-guide' 'user-guide' \ - 'user-guide-admin' - case "$PURPOSE" in - test) - openstack-doc-test -v --check-build -l ja \ - --only-book high-availability-guide \ - --only-book image-guide \ - --only-book install-guide \ - --only-book user-guide \ - --only-book user-guide-admin - RET=$? - ;; - publish) - openstack-doc-test -v --publish --check-build -l ja \ - --only-book high-availability-guide \ - --only-book image-guide \ - --only-book install-guide \ - --only-book user-guide \ - --only-book user-guide-admin - RET=$? - ;; - esac - if [ "$RET" -eq "0" ] ; then - echo "... succeeded" - else - echo "... failed" - BUILD_FAIL=1 - fi -} - -function test_language () { - - case "$language" in - all) - test_fr - test_ja - ;; - fr) - test_fr - ;; - ja) - test_ja - ;; - *) - BUILD_FAIL=1 - echo "Language $language not handled" - ;; - esac -} - -function usage () { - echo "Call the script as: " - echo "$0 PURPOSE LANGUAGE1 LANGUAGE2..." - echo "PURPOSE is either 'test' or 'publish'." - echo "LANGUAGE can also be 'all'." -} - -if [ "$#" -lt 2 ] ; then - usage - exit 1 -fi -if [ "$1" = "test" ] ; then - PURPOSE="test" -elif [ "$1" = "publish" ] ; then - PURPOSE="publish" -else - usage - exit 1 -fi -shift -BUILD_FAIL=0 -for language in "$@" ; do - echo - echo "Building for language $language" - echo - test_language "$language" -done - -exit $BUILD_FAIL diff --git a/tox.ini b/tox.ini index 852a9c0e1c..185d6eb1f3 100644 --- a/tox.ini +++ b/tox.ini @@ -1,6 +1,6 @@ [tox] minversion = 1.6 -envlist = checkniceness,checksyntax,checkdeletions,checkbuild,checklinks +envlist = checkniceness,checksyntax,checkdeletions,checkbuild,checklang,checklinks skipsdist = True [testenv] @@ -34,12 +34,14 @@ commands = commands = openstack-doc-test --check-deletions {posargs} [testenv:checkbuild] +# Build first the www pages so that openstack-doc-test creates a link to +# www/www-index.html. commands = - openstack-doc-test --check-build {posargs} mkdir -p publish-docs/www python tools/www-generator.py --source-directory www/ --output-directory publish-docs/www/ cp www/www-index.html publish-docs/ rsync -a www/static/ publish-docs/www/ + openstack-doc-test --check-build {posargs} [testenv:publishdocs] # Prepare all documents (except www subdir) so that they can get @@ -62,8 +64,8 @@ commands = # in the venv. Since it's installed in the system, let's # use sitepackages. sitepackages=True -whitelist_externals = bash -commands = bash tools/test-languages.sh test all +whitelist_externals = doc-tools-check-languages +commands = doc-tools-check-languages doc-tools-check-languages.conf test all [testenv:buildlang] # Run as "tox -e buildlang -- $LANG" @@ -71,13 +73,13 @@ commands = bash tools/test-languages.sh test all # in the venv. Since it's installed in the system, let's # use sitepackages. sitepackages=True -whitelist_externals = bash -commands = bash tools/test-languages.sh test {posargs} +whitelist_externals = doc-tools-check-languages +commands = doc-tools-check-languages doc-tools-check-languages.conf test {posargs} [testenv:publishlang] # Generatedocbook needs xml2po which cannot be installed # in the venv. Since it's installed in the system, let's # use sitepackages. sitepackages=True -whitelist_externals = bash -commands = bash tools/test-languages.sh publish all +whitelist_externals = doc-tools-check-languages +commands = doc-tools-check-languages doc-tools-check-languages.conf publish all