[Bf-blender-cvs] [3a3b36cf50f] arcpatch-D9139: PyDoc: Fix 90% of sphinx-build warnings

Aaron Carlisle noreply at git.blender.org
Wed Oct 7 21:33:45 CEST 2020


Commit: 3a3b36cf50f276ad4c23fb32f07ede2efb2801eb
Author: Aaron Carlisle
Date:   Wed Oct 7 13:15:19 2020 -0400
Branches: arcpatch-D9139
https://developer.blender.org/rB3a3b36cf50f276ad4c23fb32f07ede2efb2801eb

PyDoc: Fix 90% of sphinx-build warnings

This is a second attempt at rB953c232db31f1a76f99ceb43119681ce0df1ab17 which got reverted

Changes:

- Document `bpy.ops.*` as classes and not modules (`bpy.ops`) is still a module. Changes here were also made to increase the indent to reduce the documentation scope (sphinx was complaining because to class functions were the same).
- Remove `.. module:: bpy.types` from each bpy type page. Sphinx complains because there are multiple modules with the same name. Changes are are made here to document as a class.
- Change the bpy data module from `.. module:: bpy` to`.. module:: bpy.data`

These changes were tested to insure the urls and xrefs were the same (see rBaead4b3cab472b96fa0e07c289979c28f5fc22a5)

Total errors went from 1263 to 120. The remaining errors regarding duplicate object descriptions are a bit harder to fix.

Differential Revision: https://developer.blender.org/D9139

===================================================================

M	doc/python_api/sphinx_doc_gen.py

===================================================================

diff --git a/doc/python_api/sphinx_doc_gen.py b/doc/python_api/sphinx_doc_gen.py
index 9526e236f20..26a12e733b2 100644
--- a/doc/python_api/sphinx_doc_gen.py
+++ b/doc/python_api/sphinx_doc_gen.py
@@ -1312,8 +1312,6 @@ def pyrna2sphinx(basepath):
 
         fw(title_string(title, "="))
 
-        fw(".. module:: %s\n\n" % struct_module_name)
-
         # docs first?, ok
         write_example_ref("", fw, "%s.%s" % (struct_module_name, struct_id))
 
@@ -1349,9 +1347,9 @@ def pyrna2sphinx(basepath):
                 base_id = _BPY_STRUCT_FAKE
 
         if base_id:
-            fw(".. class:: %s(%s)\n\n" % (struct_id, base_id))
+            fw(".. class:: %s.%s(%s)\n\n" % (struct_module_name, struct_id, base_id))
         else:
-            fw(".. class:: %s\n\n" % struct_id)
+            fw(".. class:: %s.%s\n\n" % (struct_module_name, struct_id))
 
         fw("   %s\n\n" % struct.description)
 
@@ -1611,13 +1609,13 @@ def pyrna2sphinx(basepath):
 
             fw(title_string(title, "="))
 
-            fw(".. module:: bpy.ops.%s\n\n" % op_module_name)
+            fw(".. class:: bpy.ops.%s\n\n" % op_module_name)
 
             ops_mod.sort(key=lambda op: op.func_name)
 
             for op in ops_mod:
                 args_str = ", ".join(prop.get_arg_default(force=True) for prop in op.args)
-                fw(".. function:: %s(%s)\n\n" % (op.func_name, args_str))
+                fw("   .. function:: %s(%s)\n\n" % (op.func_name, args_str))
 
                 # if the description isn't valid, we output the standard warning
                 # with a link to the wiki so that people can help
@@ -1626,9 +1624,9 @@ def pyrna2sphinx(basepath):
                 else:
                     operator_description = op.description
 
-                fw("   %s\n\n" % operator_description)
+                fw("      %s\n\n" % operator_description)
                 for prop in op.args:
-                    write_param("   ", fw, prop)
+                    write_param("      ", fw, prop)
                 if op.args:
                     fw("\n")
 
@@ -1899,7 +1897,7 @@ def write_rst_data(basepath):
         file = open(filepath, "w", encoding="utf-8")
         fw = file.write
         fw(title_string("Data Access (bpy.data)", "="))
-        fw(".. module:: bpy\n")
+        fw(".. module:: bpy.data\n")
         fw("\n")
         fw("This module is used for all Blender/Python access.\n")
         fw("\n")



More information about the Bf-blender-cvs mailing list