Update for doc-tools 0.18.1

Use new doc-tools-check-languages script and add configuration file for
it. Remove the now obsolete tools/test-languages.sh.

Adjust checkbuild target so that generated index pages can be reviewed
easily.

Change-Id: I28462fb19e5f999c298e7d8cc2cc7dda41f35929
This commit is contained in:
Andreas Jaeger 2014-08-15 20:06:44 +02:00
parent 7992428573
commit 2d04ed1a60
4 changed files with 31 additions and 139 deletions

View File

@ -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/"

View File

@ -1,4 +1,4 @@
Jinja2 Jinja2
openstack-doc-tools>=0.17 openstack-doc-tools>=0.18.1
sphinx>=1.1.2,!=1.2.0,<1.3 sphinx>=1.1.2,!=1.2.0,<1.3
oslosphinx oslosphinx

View File

@ -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

18
tox.ini
View File

@ -1,6 +1,6 @@
[tox] [tox]
minversion = 1.6 minversion = 1.6
envlist = checkniceness,checksyntax,checkdeletions,checkbuild,checklinks envlist = checkniceness,checksyntax,checkdeletions,checkbuild,checklang,checklinks
skipsdist = True skipsdist = True
[testenv] [testenv]
@ -34,12 +34,14 @@ commands =
commands = openstack-doc-test --check-deletions {posargs} commands = openstack-doc-test --check-deletions {posargs}
[testenv:checkbuild] [testenv:checkbuild]
# Build first the www pages so that openstack-doc-test creates a link to
# www/www-index.html.
commands = commands =
openstack-doc-test --check-build {posargs}
mkdir -p publish-docs/www mkdir -p publish-docs/www
python tools/www-generator.py --source-directory www/ --output-directory publish-docs/www/ python tools/www-generator.py --source-directory www/ --output-directory publish-docs/www/
cp www/www-index.html publish-docs/ cp www/www-index.html publish-docs/
rsync -a www/static/ publish-docs/www/ rsync -a www/static/ publish-docs/www/
openstack-doc-test --check-build {posargs}
[testenv:publishdocs] [testenv:publishdocs]
# Prepare all documents (except www subdir) so that they can get # 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 # in the venv. Since it's installed in the system, let's
# use sitepackages. # use sitepackages.
sitepackages=True sitepackages=True
whitelist_externals = bash whitelist_externals = doc-tools-check-languages
commands = bash tools/test-languages.sh test all commands = doc-tools-check-languages doc-tools-check-languages.conf test all
[testenv:buildlang] [testenv:buildlang]
# Run as "tox -e buildlang -- $LANG" # 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 # in the venv. Since it's installed in the system, let's
# use sitepackages. # use sitepackages.
sitepackages=True sitepackages=True
whitelist_externals = bash whitelist_externals = doc-tools-check-languages
commands = bash tools/test-languages.sh test {posargs} commands = doc-tools-check-languages doc-tools-check-languages.conf test {posargs}
[testenv:publishlang] [testenv:publishlang]
# Generatedocbook needs xml2po which cannot be installed # Generatedocbook needs xml2po which cannot be installed
# in the venv. Since it's installed in the system, let's # in the venv. Since it's installed in the system, let's
# use sitepackages. # use sitepackages.
sitepackages=True sitepackages=True
whitelist_externals = bash whitelist_externals = doc-tools-check-languages
commands = bash tools/test-languages.sh publish all commands = doc-tools-check-languages doc-tools-check-languages.conf publish all