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:
parent
7992428573
commit
2d04ed1a60
20
doc-tools-check-languages.conf
Normal file
20
doc-tools-check-languages.conf
Normal 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/"
|
@ -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
|
||||
|
@ -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
18
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
|
||||
|
Loading…
Reference in New Issue
Block a user