Merge branch 'blender2.7'
[blender.git] / doc / python_api / sphinx_changelog_gen.py
index afc253940d4505ca5aef0ef7c50251188552a7a3..c96412b9d65cf98aaae77262a25c78388d11af03 100644 (file)
@@ -27,7 +27,7 @@ output from this tool should be added into "doc/python_api/rst/change_log.rst"
 blender --background --python doc/python_api/sphinx_changelog_gen.py -- --dump
 
 # create changelog
-blender --background --python doc/python_api/sphinx_changelog_gen.py -- \
+blender --background --factory-startup --python doc/python_api/sphinx_changelog_gen.py -- \
         --api_from blender_2_63_0.py \
         --api_to   blender_2_64_0.py \
         --api_out changes.rst
@@ -48,7 +48,8 @@ python doc/python_api/sphinx_changelog_gen.py -- \
 '''
 {"module.name":
     {"parent.class":
-        {"basic_type", "member_name": ("Name", type, range, length, default, descr, f_args, f_arg_types, f_ret_types)}, ...
+        {"basic_type", "member_name":
+            ("Name", type, range, length, default, descr, f_args, f_arg_types, f_ret_types)}, ...
     }, ...
 }
 '''
@@ -72,19 +73,19 @@ def api_dump():
     import inspect
 
     struct = rna_info.BuildRNAInfo()[0]
-    for struct_id, strict_info in sorted(struct.items()):
+    for struct_id, struct_info in sorted(struct.items()):
 
-        struct_id_str = strict_info.identifier
+        struct_id_str = struct_info.identifier
 
         if rna_info.rna_id_ignore(struct_id_str):
             continue
 
-        for base in strict_info.get_bases():
+        for base in struct_info.get_bases():
             struct_id_str = base.identifier + "." + struct_id_str
 
         dump_class = dump_module[struct_id_str] = {}
 
-        props = [(prop.identifier, prop) for prop in strict_info.properties]
+        props = [(prop.identifier, prop) for prop in struct_info.properties]
         for prop_id, prop in sorted(props):
             # if prop.type == 'boolean':
             #     continue
@@ -99,37 +100,37 @@ def api_dump():
                 prop_range = None
 
             dump_class[prop_id] = (
-                    "prop_rna",                 # basic_type
-                    prop.name,                  # name
-                    prop_type,                  # type
-                    prop_range,                 # range
-                    prop_length,                # length
-                    prop.default,               # default
-                    prop.description,           # descr
-                    Ellipsis,                   # f_args
-                    Ellipsis,                   # f_arg_types
-                    Ellipsis,                   # f_ret_types
-                    )
+                "prop_rna",                 # basic_type
+                prop.name,                  # name
+                prop_type,                  # type
+                prop_range,                 # range
+                prop_length,                # length
+                prop.default,               # default
+                prop.description,           # descr
+                Ellipsis,                   # f_args
+                Ellipsis,                   # f_arg_types
+                Ellipsis,                   # f_ret_types
+            )
         del props
 
-        # python props, tricky since we dont know much about them.
-        for prop_id, attr in strict_info.get_py_properties():
+        # python props, tricky since we don't know much about them.
+        for prop_id, attr in struct_info.get_py_properties():
 
             dump_class[prop_id] = (
-                    "prop_py",                  # basic_type
-                    Ellipsis,                   # name
-                    Ellipsis,                   # type
-                    Ellipsis,                   # range
-                    Ellipsis,                   # length
-                    Ellipsis,                   # default
-                    attr.__doc__,               # descr
-                    Ellipsis,                   # f_args
-                    Ellipsis,                   # f_arg_types
-                    Ellipsis,                   # f_ret_types
-                    )
+                "prop_py",                  # basic_type
+                Ellipsis,                   # name
+                Ellipsis,                   # type
+                Ellipsis,                   # range
+                Ellipsis,                   # length
+                Ellipsis,                   # default
+                attr.__doc__,               # descr
+                Ellipsis,                   # f_args
+                Ellipsis,                   # f_arg_types
+                Ellipsis,                   # f_ret_types
+            )
 
         # kludge func -> props
-        funcs = [(func.identifier, func) for func in strict_info.functions]
+        funcs = [(func.identifier, func) for func in struct_info.functions]
         for func_id, func in funcs:
 
             func_ret_types = tuple([prop.type for prop in func.return_values])
@@ -137,38 +138,38 @@ def api_dump():
             func_args_type = tuple([prop.type for prop in func.args])
 
             dump_class[func_id] = (
-                    "func_rna",                 # basic_type
-                    Ellipsis,                   # name
-                    Ellipsis,                   # type
-                    Ellipsis,                   # range
-                    Ellipsis,                   # length
-                    Ellipsis,                   # default
-                    func.description,           # descr
-                    func_args_ids,              # f_args
-                    func_args_type,             # f_arg_types
-                    func_ret_types,             # f_ret_types
-                    )
+                "func_rna",                 # basic_type
+                Ellipsis,                   # name
+                Ellipsis,                   # type
+                Ellipsis,                   # range
+                Ellipsis,                   # length
+                Ellipsis,                   # default
+                func.description,           # descr
+                func_args_ids,              # f_args
+                func_args_type,             # f_arg_types
+                func_ret_types,             # f_ret_types
+            )
         del funcs
 
         # kludge func -> props
-        funcs = strict_info.get_py_functions()
+        funcs = struct_info.get_py_functions()
         for func_id, attr in funcs:
             # arg_str = inspect.formatargspec(*inspect.getargspec(py_func))
 
             func_args_ids = tuple(inspect.getargspec(attr).args)
 
             dump_class[func_id] = (
-                    "func_py",                  # basic_type
-                    Ellipsis,                   # name
-                    Ellipsis,                   # type
-                    Ellipsis,                   # range
-                    Ellipsis,                   # length
-                    Ellipsis,                   # default
-                    attr.__doc__,               # descr
-                    func_args_ids,              # f_args
-                    Ellipsis,                   # f_arg_types
-                    Ellipsis,                   # f_ret_types
-                    )
+                "func_py",                  # basic_type
+                Ellipsis,                   # name
+                Ellipsis,                   # type
+                Ellipsis,                   # range
+                Ellipsis,                   # length
+                Ellipsis,                   # default
+                attr.__doc__,               # descr
+                func_args_ids,              # f_args
+                Ellipsis,                   # f_arg_types
+                Ellipsis,                   # f_ret_types
+            )
         del funcs
 
     import pprint
@@ -288,7 +289,7 @@ def api_changelog(api_from, api_to, api_out):
         if props_old:
             write_title("Removed", "^")
             for prop_id in props_old:
-                fw("* **%s**\n" % prop_id)  # cant link to remvoed docs
+                fw("* **%s**\n" % prop_id)  # can't link to removed docs
             fw("\n")
 
         if props_moved:
@@ -316,7 +317,7 @@ def main():
 
     try:
         import argparse
-    except:
+    except ImportError:
         print("Old Blender, just dumping")
         api_dump()
         return
@@ -330,23 +331,27 @@ def main():
 
     # When --help or no args are given, print this help
     usage_text = "Run blender in background mode with this script: "
-    "blender --background --python %s -- [options]" % os.path.basename(__file__)
+    "blender --background --factory-startup --python %s -- [options]" % os.path.basename(__file__)
 
     epilog = "Run this before releases"
 
     parser = argparse.ArgumentParser(description=usage_text, epilog=epilog)
 
-    parser.add_argument("--dump", dest="dump", action='store_true',
-            help="When set the api will be dumped into blender_version.py")
-
-    parser.add_argument("--api_from", dest="api_from", metavar='FILE',
-            help="File to compare from (previous version)")
-    parser.add_argument("--api_to", dest="api_to", metavar='FILE',
-            help="File to compare from (current)")
-    parser.add_argument("--api_out", dest="api_out", metavar='FILE',
-            help="Output sphinx changelog")
-
-    args = parser.parse_args(argv)  # In this example we wont use the args
+    parser.add_argument(
+        "--dump", dest="dump", action='store_true',
+        help="When set the api will be dumped into blender_version.py")
+
+    parser.add_argument(
+        "--api_from", dest="api_from", metavar='FILE',
+        help="File to compare from (previous version)")
+    parser.add_argument(
+        "--api_to", dest="api_to", metavar='FILE',
+        help="File to compare from (current)")
+    parser.add_argument(
+        "--api_out", dest="api_out", metavar='FILE',
+        help="Output sphinx changelog")
+
+    args = parser.parse_args(argv)  # In this example we won't use the args
 
     if not argv:
         print("No args given!")