From f9a5a2c09969e4b8a8973a9bf250090a242998dd Mon Sep 17 00:00:00 2001 From: qijun Date: Tue, 25 Apr 2017 11:21:13 +0800 Subject: [PATCH] follow comments --- doc/howto/dev/write_docs_cn.rst | 10 +++--- paddle/scripts/docker/build.sh | 6 ++++ paddle/scripts/tools/build_docs/build_docs.sh | 36 ++++++++++++++++++- 3 files changed, 46 insertions(+), 6 deletions(-) diff --git a/doc/howto/dev/write_docs_cn.rst b/doc/howto/dev/write_docs_cn.rst index dfe6219d8..c8dd3d507 100644 --- a/doc/howto/dev/write_docs_cn.rst +++ b/doc/howto/dev/write_docs_cn.rst @@ -16,7 +16,7 @@ PaddlePaddle的文档构建有直接构建和基于Docker构建两种方式。 使用Docker构建PaddlePaddle的文档,需要在系统里先安装好Docker工具包。Docker安装请参考 `Docker的官网 `_ 。安装好Docker之后可以使用源码目录下的脚本构建文档,即 -.. code-block:: bash +.. code-block:: bash cd TO_YOUR_PADDLE_CLONE_PATH bash paddle/scripts/tools/build_docs.sh @@ -35,7 +35,7 @@ PaddlePaddle的文档构建有直接构建和基于Docker构建两种方式。 因为PaddlePaddle的v2 api文档生成过程依赖于py_paddle Python包,用户需要首先确认py_paddle包已经安装。 -.. code-block:: bash +.. code-block:: bash python -c "import py_paddle" @@ -44,7 +44,7 @@ PaddlePaddle的文档构建有直接构建和基于Docker构建两种方式。 如果提示正确,可以执行以下命令编译生成文档,即 -.. code-block:: bash +.. code-block:: bash cd TO_YOUR_PADDLE_CLONE_PATH mkdir build_doc @@ -73,5 +73,5 @@ PaddlePaddle文档使用 `sphinx`_ 自动生成,用户可以参考sphinx教程 -.. _cmake: https://cmake.org/ -.. _sphinx: http://www.sphinx-doc.org/en/1.4.8/ +.. _cmake: https://cmake.org/ +.. _sphinx: http://www.sphinx-doc.org/en/1.4.8/ diff --git a/paddle/scripts/docker/build.sh b/paddle/scripts/docker/build.sh index 73f885c1e..6fce3b73d 100644 --- a/paddle/scripts/docker/build.sh +++ b/paddle/scripts/docker/build.sh @@ -57,7 +57,13 @@ if [ ${WITH_DOC} == "ON" ]; then -DWITH_SWIG_PY=ON \ -DWITH_STYLE_CHECK=OFF make paddle_docs paddle_docs_cn + $DOC_DIR=/paddle/paddle/scripts/tools/build_docs/ + mkdir -p $DOC_DIR/doc + mkdir -p $DOC_DIR/doc_cn + cp -r /paddle/build_doc/doc/doc/en/html/* $DOC_DIR/doc + cp -r /paddle/build_doc/doc/cn/html/* $DOC_DIR/doc_cn popd + rm -rf /paddle/build_doc fi # generate deb package for current build # FIXME(typhoonzero): should we remove paddle/scripts/deb ? diff --git a/paddle/scripts/tools/build_docs/build_docs.sh b/paddle/scripts/tools/build_docs/build_docs.sh index fb8c26a69..61db773d8 100755 --- a/paddle/scripts/tools/build_docs/build_docs.sh +++ b/paddle/scripts/tools/build_docs/build_docs.sh @@ -1,3 +1,37 @@ #!/bin/bash set -e -docker run --rm -v $PWD:/paddle -e "WITH_GPU=OFF" -e "WITH_AVX=ON" -e "WITH_DOC=ON" paddledev/paddle:dev +function usage(){ + echo "usage: build_doc [--help] []" + echo "This script generates doc and doc_cn in the script's directory." + echo "These are common commands used in various situations:" + echo " with_docker build doc and doc_cn with docker" + echo " local build doc and doc_cn locally" +} + + +MYDIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" +PADDLE_SOURCE_DIR=$MYDIR/../../../../ +case "$1" in + "with_docker") + docker run --rm -v $PADDLE_SOURCE_DIR:/paddle \ + -e "WITH_GPU=OFF" -e "WITH_AVX=ON" -e "WITH_DOC=ON" paddledev/paddle:dev + ;; + "local") + mkdir -p $MYDIR/doc + mkdir -p $MYDIR/doc_cn + mkdir -p $PADDLE_SOURCE_DIR/build_doc + pushd $PADDLE_SOURCE_DIR/build_doc + cmake .. -DWITH_DOC=ON + make paddle_docs paddle_docs_cn + cp -r $PADDLE_SOURCE_DIR/build_doc/doc/en/html/* $MYDIR/doc + cp -r $PADDLE_SOURCE_DIR/build_doc/doc/cn/html/* $MYDIR/doc_cn + popd + rm -rf $PADDLE_SOURCE_DIR/build_doc + ;; + "--help") + usage + ;; + *) + usage + ;; +esac -- GitLab