From cddca9f60679ae604ffe5ac2dd66043bf26d7fdb Mon Sep 17 00:00:00 2001 From: Luca Bonavita Date: Fri, 16 Mar 2012 10:49:39 +0000 Subject: [PATCH] == Python API docs == Committing a patch similar to revision 44887 with fixes to my own bugs (sorry Campbell, and thanks for reviewing :) Fixes ------ - examples/ svn directory not removed anymore (in-source builds possible again) - fixed "include references somehow stopped working" + using shutils.makearchive() to zip the file New command line options ------------------------ -l: Log the output of the api dump and sphinx|latex warnings and errors If given, save logs in: * OUTPUT_DIR/.bpy.log * OUTPUT_DIR/.sphinx-build.log * OUTPUT_DIR/.sphinx-build_pdf.log * OUTPUT_DIR/.latex_make.log (using only one log directive instead of -l for bpy and -L for sphinx) -P: builds the pdf -R: pack the files in a dir ready for online deployment (including the zip and the pdf eventually) Example usage: ./blender.bin -b -P doc/python_api/sphinx_doc_gen.py -- -p bmesh* -o ./ -B -P -R -l --- doc/python_api/sphinx_doc_gen.py | 357 ++++++++++++++++++++++--------- 1 file changed, 260 insertions(+), 97 deletions(-) diff --git a/doc/python_api/sphinx_doc_gen.py b/doc/python_api/sphinx_doc_gen.py index b15fcd9303b..327707facc7 100644 --- a/doc/python_api/sphinx_doc_gen.py +++ b/doc/python_api/sphinx_doc_gen.py @@ -26,16 +26,16 @@ API dump in RST files --------------------- Run this script from blenders root path once you have compiled blender - ./blender.bin -b -noaudio -P doc/python_api/sphinx_doc_gen.py + ./blender.bin --background -noaudio --python doc/python_api/sphinx_doc_gen.py This will generate python files in doc/python_api/sphinx-in/ providing ./blender.bin is or links to the blender executable To choose sphinx-in directory: - ./blender.bin -b -P doc/python_api/sphinx_doc_gen.py -- -o ../python_api + ./blender.bin --background --python doc/python_api/sphinx_doc_gen.py -- -o ../python_api For quick builds: - ./blender.bin -b -P doc/python_api/sphinx_doc_gen.py -- -q + ./blender.bin --background --python doc/python_api/sphinx_doc_gen.py -- -p Sphinx: HTML generation @@ -75,6 +75,7 @@ import os import sys import inspect import shutil +import logging from platform import platform PLATFORM = platform().split('-')[0].lower() # 'linux', 'darwin', 'windows' @@ -94,27 +95,36 @@ def handle_args(): usage=SCRIPT_HELP_MSG ) - # optional arguments + # optional arguments + parser.add_argument("-p", "--partial", + dest="partial", + type=str, + default="", + help="Use a wildcard to only build specific module(s)\n" + "Example: --partial bmesh*\n", + required=False) + + parser.add_argument("-f", "--fullrebuild", + dest="full_rebuild", + default=False, + action='store_true', + help="Rewrite all rst files in sphinx-in/ " + "(default=False)", + required=False) + + parser.add_argument("-b", "--bpy", + dest="bpy", + default=False, + action='store_true', + help="Write the rst file of the bpy module " + "(default=False)", + required=False) + parser.add_argument("-o", "--output", dest="output_dir", type=str, default=SCRIPT_DIR, - # XXX, THIS ISNT WORKING, EXAMPLE SCRIPTS WILL NOT BE FOUND - help="Path of the API docs (default=