Change docs build to openstackdocstheme logic
Version 1.29 of openstackdocstheme includes now the build scripts for translated documents which we have had as a PoC in that repo. Fix Sphinx Warnings (a lot) Change-Id: I4f9a48bd543e8d394f23491fadb6ac47f24a156a
This commit is contained in:
parent
ff31b374d7
commit
9fd0fdc774
@ -4,7 +4,7 @@
|
||||
|
||||
# this is required for the docs build jobs
|
||||
sphinx!=1.6.6,!=1.6.7,>=1.6.2 # BSD
|
||||
openstackdocstheme>=1.18.1 # Apache-2.0
|
||||
openstackdocstheme>=1.29.2 # Apache-2.0
|
||||
reno>=2.5.0 # Apache-2.0
|
||||
sphinxmark>=0.1.14 # Apache-2.0
|
||||
doc8>=0.6.0 # Apache-2.0
|
||||
|
@ -144,7 +144,9 @@ language = None
|
||||
|
||||
# List of patterns, relative to source directory, that match files and
|
||||
# directories to ignore when looking for source files.
|
||||
exclude_patterns = []
|
||||
exclude_patterns = [
|
||||
'admin/maintenance-tasks/galera.rst'
|
||||
]
|
||||
|
||||
# The reST default role (used for this markup: `text`) to use for all
|
||||
# documents.
|
||||
|
@ -30,7 +30,6 @@ Contents:
|
||||
code-rules
|
||||
testing
|
||||
periodic-work
|
||||
scripts
|
||||
core-reviewers
|
||||
distributions
|
||||
|
||||
|
@ -113,7 +113,7 @@ add Zookeeper as coordination backend. To setup Zookeeper, you can use
|
||||
|
||||
Create containers for Zookeeper:
|
||||
|
||||
.. code-block:: yaml
|
||||
.. code-block:: console
|
||||
|
||||
## conf.d
|
||||
zookeeper_hosts:
|
||||
@ -122,7 +122,7 @@ Create containers for Zookeeper:
|
||||
ip: {{ hostvars[server]['ansible_default_ipv4']['address'] }}
|
||||
{% endfor%}
|
||||
|
||||
.. code-block:: yaml
|
||||
.. code-block:: console
|
||||
|
||||
## env.d
|
||||
component_skel:
|
||||
@ -142,13 +142,13 @@ Create containers for Zookeeper:
|
||||
|
||||
Now you can set up Zookeeper as coordination backend for Gnocchi:
|
||||
|
||||
.. code-block:: yaml
|
||||
.. code-block:: console
|
||||
|
||||
gnocchi_coordination_url: "zookeeper://{% for host in groups['zookeeper_all'] %}{{ hostvars[host]['container_address'] }}:2181{% if not loop.last %},{% endif %}{% endfor %}"
|
||||
|
||||
You also have to install additional packages:
|
||||
|
||||
.. code-block:: yaml
|
||||
.. code-block:: console
|
||||
|
||||
gnocchi_pip_packages:
|
||||
- cryptography
|
||||
|
@ -1,86 +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.
|
||||
|
||||
# Build English and translated version of project documentation
|
||||
|
||||
DOCNAME=doc
|
||||
DIRECTORY=doc
|
||||
|
||||
# clean build dir
|
||||
rm -rf ${DIRECTORY}/build/
|
||||
|
||||
# create pot files
|
||||
sphinx-build -a -b gettext \
|
||||
-d ${DIRECTORY}/build/doctrees.gettext \
|
||||
${DIRECTORY}/source ${DIRECTORY}/source/locale/
|
||||
|
||||
# check all language translation resouce
|
||||
for locale in `find ${DIRECTORY}/source/locale/ -maxdepth 1 -type d` ; do
|
||||
# skip if it is not a valid language translation resource.
|
||||
if [ ! -d ${locale}/LC_MESSAGES/ ]; then
|
||||
continue
|
||||
fi
|
||||
language=$(basename $locale)
|
||||
|
||||
echo "===== Building $language translation ====="
|
||||
|
||||
# prepare all translation resources
|
||||
for pot in ${DIRECTORY}/source/locale/*.pot ; do
|
||||
# get filename
|
||||
potname=$(basename $pot)
|
||||
resname=${potname%.pot}
|
||||
# merge all translation resources
|
||||
# "{resname}.pot" needs to be merged with "doc-{resname}.po" if exists
|
||||
if [ -e ${DIRECTORY}/source/locale/${language}/LC_MESSAGES/${DOCNAME}-${resname}.po ]; then
|
||||
msgmerge -q -o \
|
||||
${DIRECTORY}/source/locale/${language}/LC_MESSAGES/${resname}.po \
|
||||
${DIRECTORY}/source/locale/${language}/LC_MESSAGES/${DOCNAME}-${resname}.po \
|
||||
${DIRECTORY}/source/locale/${potname}
|
||||
elif [ -e ${DIRECTORY}/source/locale/${language}/LC_MESSAGES/${DOCNAME}.po ]; then
|
||||
msgmerge -q -o \
|
||||
${DIRECTORY}/source/locale/${language}/LC_MESSAGES/${resname}.po \
|
||||
${DIRECTORY}/source/locale/${language}/LC_MESSAGES/${DOCNAME}.po \
|
||||
${DIRECTORY}/source/locale/${potname}
|
||||
else
|
||||
msgcat ${DIRECTORY}/source/locale/${potname} > \
|
||||
${DIRECTORY}/source/locale/${language}/LC_MESSAGES/${resname}.po
|
||||
fi
|
||||
# compile all translation resources
|
||||
msgfmt -o \
|
||||
${DIRECTORY}/source/locale/${language}/LC_MESSAGES/${resname}.mo \
|
||||
${DIRECTORY}/source/locale/${language}/LC_MESSAGES/${resname}.po
|
||||
done
|
||||
|
||||
# build language version
|
||||
sphinx-build -a -b html -D language=${language} \
|
||||
-d ${DIRECTORY}/build/doctrees.languages/${language} \
|
||||
${DIRECTORY}/source ${DIRECTORY}/build/html/${language}
|
||||
|
||||
# remove newly created files
|
||||
git clean -f -q ${DIRECTORY}/source/locale/${language}/LC_MESSAGES/*.po
|
||||
git clean -f -x -q ${DIRECTORY}/source/locale/${language}/LC_MESSAGES/*.mo
|
||||
git clean -f -x -q ${DIRECTORY}/source/locale/.doctrees
|
||||
# revert changes to po file
|
||||
git reset -q ${DIRECTORY}/source/locale/${language}/LC_MESSAGES/
|
||||
for po in `git ls-files ${DIRECTORY}/source/locale/${language}/LC_MESSAGES` ; do
|
||||
git checkout -q -- $po
|
||||
done
|
||||
done
|
||||
# remove generated pot files
|
||||
git clean -f -q ${DIRECTORY}/source/locale/*.pot
|
||||
|
||||
# build english version
|
||||
sphinx-build -a -b html \
|
||||
-d ${DIRECTORY}/build/doctrees \
|
||||
${DIRECTORY}/source ${DIRECTORY}/build/html/
|
4
tox.ini
4
tox.ini
@ -43,8 +43,7 @@ basepython = python3
|
||||
deps = -r{toxinidir}/doc/requirements.txt
|
||||
commands=
|
||||
doc8 doc
|
||||
bashate tools/build-docs.sh
|
||||
{toxinidir}/tools/build-docs.sh
|
||||
docstheme-build-translated.sh
|
||||
|
||||
|
||||
|
||||
@ -58,6 +57,7 @@ commands = sphinx-build -a -E -W -d deploy-guide/build/doctrees -b html deploy-g
|
||||
[doc8]
|
||||
# Settings for doc8:
|
||||
extensions = .rst
|
||||
ignore = D001
|
||||
|
||||
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user