Browse Source

Merge "Cleanup doc-tools-check-languages"

tags/2.0.0
Zuul 2 months ago
parent
commit
6c0858175d
1 changed files with 15 additions and 43 deletions
  1. 15
    43
      bin/doc-tools-check-languages

+ 15
- 43
bin/doc-tools-check-languages View File

@@ -12,8 +12,6 @@
# License for the specific language governing permissions and limitations
# under the License.

FIRSTAPP_TAGS="libcloud dotnet fog openstacksdk pkgcloud shade"

# This marker is needed for Infra publishing and needs to go into the
# root directory of each translated manual as file ".root-marker".
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
# together with openstackdocstheme. With SitePackages, the global Sphinx
# 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"
LOCALE_DIR="${DOC_DIR}${book}/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}


@@ -85,35 +78,19 @@ function build_rst {
${DOC_DIR}${book}/source/conf.py
fi

# Build all books
if [ ${book} = "firstapp" ] ; then
# Firstapp has several variations, build all of them
for tag in $FIRSTAPP_TAGS ; do
BUILD_DIR="${DOC_DIR}${book}/build-${tag}/html"
DOCTREES="${BUILD_DIR}.doctrees"
tox -evenv -- sphinx-build -q -E \
-t $tag -D language=${language} \
-d ${DOCTREES} \
${DOC_DIR}${book}/source/ \
${BUILD_DIR}
PUBLISH_DIR=publish-docs/html/${language}/${book}-${tag}
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
# Build book
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

# Remove newly created files
git clean -f -q ${LOCALE_DIR}${language}/LC_MESSAGES/*.po
git clean -f -x -q ${LOCALE_DIR}${language}/LC_MESSAGES/*.mo
@@ -134,11 +111,6 @@ function test_language {
echo "Building for language $language"
echo

args=("-v")
if [[ $PURPOSE -eq "publish" ]]; then
args+=("--publish")
fi
args+=("--check-build" "-l $language")
for book in ${BOOKS["$language"]}; do
if [ ${SPECIAL_BOOKS[$book]+_} ] ; then
if [ ${SPECIAL_BOOKS[$book]} = "RST" ] ; then
@@ -156,7 +128,7 @@ function usage {
echo
echo "CONF_FILE is the path to the configuration file."
echo
echo "PURPOSE is either 'test' or 'publish'."
echo "PURPOSE is 'test' or 'publish' (is ignored)."
echo
echo "LANGUAGE is either 'all' or 'LANG'."
echo "LANG is a language code like 'fr' or 'ja'."

Loading…
Cancel
Save