From: Tibor Frank Date: Fri, 16 Dec 2016 11:22:54 +0000 (+0100) Subject: CSIT Documentation auto generation X-Git-Url: https://gerrit.fd.io/r/gitweb?p=csit.git;a=commitdiff_plain;h=d13861eaa681cea95cf4d366a5dc82d93ed71817 CSIT Documentation auto generation - remove all *.rst files in env from build - add ignore list for directories which will not be included in build Change-Id: Ifef18255d366094704041b526d707fdb6fc4567d Signed-off-by: Tibor Frank --- diff --git a/resources/tools/doc_gen/gen_rst.py b/resources/tools/doc_gen/gen_rst.py index 8f239d0951..e3356f5b73 100755 --- a/resources/tools/doc_gen/gen_rst.py +++ b/resources/tools/doc_gen/gen_rst.py @@ -170,6 +170,8 @@ def write_module_title(fh, module_name): def generate_py_rst_files(): """Generate all rst files for all python modules.""" + dirs_ignore_list = ["__pycache__", ] + py_libs = get_files(PATH_PY_LIBS, PY_EXT) file_names = create_rst_file_names_set(py_libs, RESOURCES_DIR) @@ -177,6 +179,13 @@ def generate_py_rst_files(): path = join(WORKING_DIR, *file_name.split('.')[:-1]) dirs, files = scan_dir(path) + for item in dirs_ignore_list: + while True: + try: + dirs.remove(item) + except ValueError: + break + full_path = join(WORKING_DIR, file_name) with open(full_path, mode='a') as fh: if getsize(full_path) == 0: diff --git a/resources/tools/doc_gen/run_doc.sh b/resources/tools/doc_gen/run_doc.sh index 1a037071a5..544554e93c 100755 --- a/resources/tools/doc_gen/run_doc.sh +++ b/resources/tools/doc_gen/run_doc.sh @@ -41,8 +41,11 @@ export PYTHONPATH=`pwd` # Generate rst files: ./gen_rst.py +# Remove all rst files from ./${WORKING_DIR}/env directory - we do not need them +find ./${WORKING_DIR}/env -type f -name '*.rst' | xargs rm -f + # Generate the documentation: -sphinx-build -vvv -b html ${WORKING_DIR}/ ${BUILD_DIR}/ +sphinx-build -v -b html ${WORKING_DIR} ${BUILD_DIR}/ find . -type d -name 'env' | xargs rm -rf