Browse Source

Add doc-tools-build-rst

Import tools/build-rst.sh from openstack-manuals to share it between all
repositories.

Change-Id: I3fd807f08a23e706a3edc70314ab276c363a43e9
changes/43/216043/3
Andreas Jaeger 6 years ago
parent
commit
2de03ff6ce
3 changed files with 92 additions and 0 deletions
  1. +5
    -0
      RELEASE_NOTES.rst
  2. +86
    -0
      bin/doc-tools-build-rst
  3. +1
    -0
      setup.cfg

+ 5
- 0
RELEASE_NOTES.rst View File

@ -1,6 +1,11 @@
Release notes
=============
0.31.0
------
* Add ``doc-tools-build-rst`` to build RST guides.
0.30.1
------


+ 86
- 0
bin/doc-tools-build-rst View File

@ -0,0 +1,86 @@
#!/bin/bash -e
#
# 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.
DIRECTORY=$1
if [ -z "$DIRECTORY" ] ; then
echo "usage $0 DIRECTORY options"
echo "Options are:"
echo "--glossary: Build glossary"
echo "--tag TAG: Use given tag for building"
echo "--target TARGET: Copy files to publish-docs/$TARGET"
echo "--build BUILD: Name of build directory"
exit 1
fi
GLOSSARY=0
TARGET=""
TAG=""
TAG_OPT=""
BUILD=""
while [[ $# > 1 ]] ; do
option="$1"
case $option in
--glossary)
GLOSSARY=1
;;
--tag)
TAG="$2"
TAG_OPT="-t $2"
shift
;;
--target)
TARGET="$2"
shift
;;
--build)
BUILD="$2"
shift
;;
esac
shift
done
if [ "$GLOSSARY" -eq "1" ] ; then
echo "Generating Glossary"
tools/glossary2rst.py doc/common-rst/glossary.rst
fi
if [ -z "$BUILD" ] ; then
if [ -z "$TAG" ] ; then
BUILD_DIR="$DIRECTORY/build/html"
else
BUILD_DIR="$DIRECTORY/build-${TAG}/html"
fi
else
BUILD_DIR="$DIRECTORY/$BUILD/html"
fi
if [ -z "$TAG" ] ; then
echo "Building $DIRECTORY"
else
echo "Building $DIRECTORY with tag $TAG"
fi
# Show sphinx-build invocation for easy reproduction
set -x
sphinx-build -E -W -b html $TAG_OPT $DIRECTORY/source $BUILD_DIR
set +x
# Copy RST
if [ "$TARGET" != "" ] ; then
mkdir -p publish-docs/$TARGET
rsync -a $BUILD_DIR/ publish-docs/$TARGET/
fi

+ 1
- 0
setup.cfg View File

@ -29,6 +29,7 @@ data_files =
scripts =
bin/doc-tools-check-languages
bin/doc-tools-update-cli-reference
bin/doc-tools-build-rst
[global]
setup-hooks =


Loading…
Cancel
Save