Move pot file generation to venv
periodic job failed since some weeks due the usage of Sphinx 2.0 in Python 2.7, called by the shell script outside venv see: http://logs.openstack.org/periodic/opendev.org/openstack/training-guides/master/propose-translation-update/a09c131/ Maybe get job working again after some weeks. Requires still a general patch for propose-translation-update to run on Bionic with Sphinx 2 and Python 3. Change-Id: I40a271bdc171ee7dc433178633c190c7bd1e8e5f
This commit is contained in:
parent
7d2fd2e37b
commit
3c26d2c63c
@ -1,47 +0,0 @@
|
||||
#!/bin/bash -xe
|
||||
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License"); you may
|
||||
# not use this file except in compliance with the License. You may obtain
|
||||
# a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
DOCNAME=upstream-training
|
||||
DIRECTORY=doc/${DOCNAME}
|
||||
|
||||
if [ -x "$(command -v getconf)" ]; then
|
||||
NUMBER_OF_CORES=$(getconf _NPROCESSORS_ONLN)
|
||||
else
|
||||
NUMBER_OF_CORES=2
|
||||
fi
|
||||
|
||||
# First remove the old pot file, otherwise the new file will contain
|
||||
# old references
|
||||
|
||||
rm -f ${DIRECTORY}/source/locale/$DOCNAME.pot
|
||||
|
||||
# upstream-training contains the HTML and slides contents
|
||||
|
||||
# build upstream-training slides
|
||||
sphinx-build -j $NUMBER_OF_CORES -b gettext ${DIRECTORY}/source/slides \
|
||||
${DIRECTORY}/source/locale/
|
||||
# build upstream landing page index.html
|
||||
sphinx-build -j $NUMBER_OF_CORES -b gettext ${DIRECTORY}/source/website \
|
||||
${DIRECTORY}/source/locale/
|
||||
|
||||
# Take care of deleting all temporary files so that
|
||||
# "git add ${DIRECTORY}/source/locale" will only add the
|
||||
# single pot file.
|
||||
# Remove UUIDs, those are not necessary and change too often
|
||||
msgcat --use-first --sort-by-file ${DIRECTORY}/source/locale/*.pot | \
|
||||
awk '$0 !~ /^\# [a-z0-9]+$/' > ${DIRECTORY}/source/$DOCNAME.pot
|
||||
rm ${DIRECTORY}/source/locale/*.pot
|
||||
rm -rf ${DIRECTORY}/source/locale/.doctrees/
|
||||
mv ${DIRECTORY}/source/$DOCNAME.pot ${DIRECTORY}/source/locale/$DOCNAME.pot
|
22
tox.ini
22
tox.ini
@ -14,9 +14,11 @@ whitelist_externals =
|
||||
mkdir
|
||||
rm
|
||||
rsync
|
||||
msgcat
|
||||
awk
|
||||
bash
|
||||
|
||||
[testenv:venv]
|
||||
basepython = python3
|
||||
commands = {posargs}
|
||||
|
||||
[doc8]
|
||||
@ -35,6 +37,20 @@ commands =
|
||||
rsync -av doc/upstream-training/build/slides/ publish-docs/upstream-training/
|
||||
rsync -av doc/training-guides/build/slides/ publish-docs/training-guides/
|
||||
|
||||
[testenv:generatepot-training]
|
||||
# Generate POT files for translation
|
||||
commands =
|
||||
rm -f doc/upstream-training/source/locale/upstream-training.pot
|
||||
sphinx-build -b gettext doc/upstream-training/source/slides \
|
||||
doc/upstream-training/source/locale/
|
||||
sphinx-build -b gettext doc/upstream-training/source/website \
|
||||
doc/upstream-training/source/locale/
|
||||
bash -c "msgcat --use-first --sort-by-file doc/upstream-training/source/locale/*.pot | \
|
||||
awk '$0 !~ /^\# [a-z0-9]+$/' > doc/upstream-training/source/upstream-training.pot && \
|
||||
rm doc/upstream-training/source/locale/*.pot && \
|
||||
rm -rf doc/upstream-training/source/locale/.doctrees/ && \
|
||||
mv doc/upstream-training/source/upstream-training.pot doc/upstream-training/source/locale/upstream-training.pot"
|
||||
|
||||
[testenv:publishdocs]
|
||||
passenv = ZUUL*
|
||||
commands =
|
||||
@ -72,7 +88,3 @@ commands =
|
||||
sphinx-build -W -b slides -d doc/training-guides/build/slides.doctrees/associate-guide doc/training-guides/source/slides doc/training-guides/build/slides/associate-guide
|
||||
# Build training-guides landing page index.html
|
||||
sphinx-build -b html -d doc/training-guides/build/slides.doctrees doc/training-guides/source/website doc/training-guides/build/slides
|
||||
|
||||
[testenv:generatepot-training]
|
||||
# Generate POT files for translation
|
||||
commands = {toxinidir}/tools/generatepot-training.sh
|
||||
|
Loading…
x
Reference in New Issue
Block a user