Merge "Cleanup doc-tools-check-languages"

This commit is contained in:
Zuul 2019-08-16 15:46:23 +00:00 committed by Gerrit Code Review
commit 6c0858175d
1 changed files with 15 additions and 43 deletions

View File

@ -12,8 +12,6 @@
# License for the specific language governing permissions and limitations # License for the specific language governing permissions and limitations
# under the License. # under the License.
FIRSTAPP_TAGS="libcloud dotnet fog openstacksdk pkgcloud shade"
# This marker is needed for Infra publishing and needs to go into the # This marker is needed for Infra publishing and needs to go into the
# root directory of each translated manual as file ".root-marker". # root directory of each translated manual as file ".root-marker".
MARKER_TEXT="Project: $ZUUL_PROJECT Ref: $ZUUL_BRANCH Build: $ZUUL_UUID Revision: $ZUUL_NEWREF" MARKER_TEXT="Project: $ZUUL_PROJECT Ref: $ZUUL_BRANCH Build: $ZUUL_UUID Revision: $ZUUL_NEWREF"
@ -28,17 +26,12 @@ function build_rst {
# uses SitePackages=True and we have to install Sphinx in the venv # uses SitePackages=True and we have to install Sphinx in the venv
# together with openstackdocstheme. With SitePackages, the global Sphinx # together with openstackdocstheme. With SitePackages, the global Sphinx
# is used and that will not work with a local openstackdocstheme installed. # is used and that will not work with a local openstackdocstheme installed.
TAG=""
# We need to extract all strings, so add all supported tags
if [ ${book} = "firstapp" ] ; then
TAG="-t libcloud -t fog -t dotnet -t openstacksdk -t pkgcloud -t shade"
fi
COMMON="common" COMMON="common"
LOCALE_DIR="${DOC_DIR}${book}/source/locale/" LOCALE_DIR="${DOC_DIR}${book}/source/locale/"
COMMON_DIR="${DOC_DIR}${COMMON}/source/locale/" COMMON_DIR="${DOC_DIR}${COMMON}/source/locale/"
tox -evenv -- sphinx-build -q -E -W -b gettext $TAG \ tox -evenv -- sphinx-build -q -E -W -b gettext \
${DOC_DIR}${book}/source/ ${LOCALE_DIR} ${DOC_DIR}${book}/source/ ${LOCALE_DIR}
@ -85,35 +78,19 @@ function build_rst {
${DOC_DIR}${book}/source/conf.py ${DOC_DIR}${book}/source/conf.py
fi fi
# Build all books # Build book
if [ ${book} = "firstapp" ] ; then BUILD_DIR="${DOC_DIR}${book}/build/html"
# Firstapp has several variations, build all of them DOCTREES="${BUILD_DIR}.doctrees"
for tag in $FIRSTAPP_TAGS ; do tox -evenv -- sphinx-build \
BUILD_DIR="${DOC_DIR}${book}/build-${tag}/html" -q -E -D language=${language} \
DOCTREES="${BUILD_DIR}.doctrees" -d ${DOCTREES} \
tox -evenv -- sphinx-build -q -E \ ${DOC_DIR}${book}/source/ \
-t $tag -D language=${language} \ ${BUILD_DIR}
-d ${DOCTREES} \ PUBLISH_DIR=publish-docs/html/${language}/${book}/
${DOC_DIR}${book}/source/ \ mkdir -p ${PUBLISH_DIR}
${BUILD_DIR} rsync -a ${DOC_DIR}${book}/build/html/ ${PUBLISH_DIR}
PUBLISH_DIR=publish-docs/html/${language}/${book}-${tag} echo $MARKER_TEXT > ${PUBLISH_DIR}/.root-marker
mkdir -p ${PUBLISH_DIR}
rsync -a ${DOC_DIR}${book}/build-${tag}/html/ ${PUBLISH_DIR}
echo $MARKER_TEXT > ${PUBLISH_DIR}/.root-marker
done
else
BUILD_DIR="${DOC_DIR}${book}/build/html"
DOCTREES="${BUILD_DIR}.doctrees"
tox -evenv -- sphinx-build \
-q -E -D language=${language} \
-d ${DOCTREES} \
${DOC_DIR}${book}/source/ \
${BUILD_DIR}
PUBLISH_DIR=publish-docs/html/${language}/${book}/
mkdir -p ${PUBLISH_DIR}
rsync -a ${DOC_DIR}${book}/build/html/ ${PUBLISH_DIR}
echo $MARKER_TEXT > ${PUBLISH_DIR}/.root-marker
fi
# Remove newly created files # Remove newly created files
git clean -f -q ${LOCALE_DIR}${language}/LC_MESSAGES/*.po git clean -f -q ${LOCALE_DIR}${language}/LC_MESSAGES/*.po
git clean -f -x -q ${LOCALE_DIR}${language}/LC_MESSAGES/*.mo git clean -f -x -q ${LOCALE_DIR}${language}/LC_MESSAGES/*.mo
@ -134,11 +111,6 @@ function test_language {
echo "Building for language $language" echo "Building for language $language"
echo echo
args=("-v")
if [[ $PURPOSE -eq "publish" ]]; then
args+=("--publish")
fi
args+=("--check-build" "-l $language")
for book in ${BOOKS["$language"]}; do for book in ${BOOKS["$language"]}; do
if [ ${SPECIAL_BOOKS[$book]+_} ] ; then if [ ${SPECIAL_BOOKS[$book]+_} ] ; then
if [ ${SPECIAL_BOOKS[$book]} = "RST" ] ; then if [ ${SPECIAL_BOOKS[$book]} = "RST" ] ; then
@ -156,7 +128,7 @@ function usage {
echo echo
echo "CONF_FILE is the path to the configuration file." echo "CONF_FILE is the path to the configuration file."
echo echo
echo "PURPOSE is either 'test' or 'publish'." echo "PURPOSE is 'test' or 'publish' (is ignored)."
echo echo
echo "LANGUAGE is either 'all' or 'LANG'." echo "LANGUAGE is either 'all' or 'LANG'."
echo "LANG is a language code like 'fr' or 'ja'." echo "LANG is a language code like 'fr' or 'ja'."