Create checklang tox.ini target

Create target to test that localized manuals are actually building.

Change-Id: Ie0ff3338373acc824f9d4f1a55e991f6ebd1af2e
This commit is contained in:
Andreas Jaeger 2014-05-15 16:41:22 -04:00
parent 0811d5c91f
commit 3db02959fe
2 changed files with 57 additions and 0 deletions

49
tools/test-languages.sh Executable file
View File

@ -0,0 +1,49 @@
#!/bin/bash
function setup_directory {
SET_LANG=$1
shift
for BOOK_DIR in "$@" ; do
openstack-generate-docbook -l $SET_LANG -b $BOOK_DIR -r ./
done
}
function setup_lang {
SET_LANG=$1
shift
echo ""
echo "Setting up files for $SET_LANG"
echo "======================="
mkdir -p generated/$SET_LANG
cp pom.xml generated/$SET_LANG/pom.xml
}
function test_manuals {
SET_LANG=$1
shift
setup_lang $SET_LANG
for BOOK in "$@" ; do
echo "Building $BOOK for language $SET_LANG..."
setup_directory $SET_LANG $BOOK
openstack-doc-test --check-build -l $SET_LANG --only-book $BOOK
RET=$?
if [ "$RET" -eq "0" ] ; then
echo "... succeeded"
else
echo "... failed"
BUILD_FAIL=1
fi
done
}
function test_all {
test_manuals 'es' 'api-quick-start'
test_manuals 'fr' 'api-quick-start'
test_manuals 'ja' 'api-quick-start'
}
BUILD_FAIL=0
test_all
exit $BUILD_FAIL

View File

@ -41,6 +41,14 @@ commands =
# We need to move api-ref-guides to the proper place:
mv publish-docs/api-ref-guides publish-docs/api-ref/
[testenv:checklang]
# 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
[testenv:buildlang]
# Run as "tox -e buildlang -- $LANG"
# openstack-generate-docbook needs xml2po which cannot be installed