PyDoc: quiet output and minor cleanup

Suppress printing unnecessary output when generating docs.
This commit is contained in:
Campbell Barton 2022-05-23 11:43:47 +10:00
parent 4d509fd6e1
commit 1e882b8657
2 changed files with 22 additions and 6 deletions

View File

@ -13,10 +13,10 @@ API dump in RST files
providing ./blender is or links to the blender executable
To choose sphinx-in directory:
blender --background --factory-startup --python doc/python_api/sphinx_doc_gen.py -- --output ../python_api
blender --background --factory-startup --python doc/python_api/sphinx_doc_gen.py -- --output=../python_api
For quick builds:
blender --background --factory-startup --python doc/python_api/sphinx_doc_gen.py -- --partial bmesh.*
blender --background --factory-startup --python doc/python_api/sphinx_doc_gen.py -- --partial=bmesh.*
Sphinx: HTML generation
@ -98,8 +98,9 @@ def handle_args():
type=str,
default="",
help="Use a wildcard to only build specific module(s)\n"
"Example: --partial bmesh*\n",
required=False,)
"Example: --partial\"=bmesh*\"\n",
required=False,
)
parser.add_argument(
"-f", "--fullrebuild",
@ -287,7 +288,7 @@ else:
if FILTER_BPY_TYPES:
EXCLUDE_MODULES.remove("bpy.types")
print(FILTER_BPY_TYPES)
# print(FILTER_BPY_TYPES)
EXCLUDE_INFO_DOCS = (not fnmatch.fnmatchcase("info", ARGS.partial))

View File

@ -585,6 +585,16 @@ def BuildRNAInfo():
structs = []
def _bpy_types_iterator():
# Don't report when these types are ignored.
suppress_warning = {
"bpy_func",
"bpy_prop",
"bpy_prop_array",
"bpy_prop_collection",
"bpy_struct",
"bpy_struct_meta_idprop",
}
names_unique = set()
rna_type_list = []
for rna_type_name in dir(bpy.types):
@ -594,8 +604,13 @@ def BuildRNAInfo():
if rna_struct is not None:
rna_type_list.append(rna_type)
yield (rna_type_name, rna_struct)
elif rna_type_name.startswith("_"):
# Ignore "__dir__", "__getattr__" .. etc.
pass
elif rna_type_name in suppress_warning:
pass
else:
print("Ignoring", rna_type_name)
print("rna_info.BuildRNAInfo(..): ignoring type", repr(rna_type_name))
# Now, there are some sub-classes in add-ons we also want to include.
# Cycles for e.g. these are referenced from the Scene, but not part of