mirror of
https://github.com/baldurk/renderdoc.git
synced 2026-08-26 00:16:45 +00:00
Don't include swig static member function wrappers in stubs
This commit is contained in:
+9
-1
@@ -24,6 +24,7 @@ import datetime
|
||||
#sys.path.insert(0, os.path.abspath('.'))
|
||||
|
||||
import struct
|
||||
import inspect
|
||||
|
||||
# path to module libraries for windows
|
||||
if struct.calcsize("P") == 8:
|
||||
@@ -481,10 +482,17 @@ def build_finished(app, exception):
|
||||
module = sys.modules[module_name]
|
||||
entries = dir(module)
|
||||
for item in dir(module):
|
||||
if '_' in item:
|
||||
segments = item.split("_")
|
||||
if hasattr(module, segments[0]) and inspect.isclass(
|
||||
getattr(module, segments[0])
|
||||
):
|
||||
continue
|
||||
|
||||
if 'INTERNAL:' not in str(module.__dict__[item].__doc__):
|
||||
items.append('{}.{}'.format(module_name, item))
|
||||
|
||||
items = set(filter(lambda i: re.search('__|SWIG|ResourceId_Null|rdcfixedarray_of|rdcarray_of|Structured.*List', i) is None, items))
|
||||
items = set(filter(lambda i: re.search('__|SWIG|rdcfixedarray_of|rdcarray_of|Structured.*List', i) is None, items))
|
||||
|
||||
# Remove any documented/indexed python objects
|
||||
items -= set(objs.keys())
|
||||
|
||||
+12
-3
@@ -113,7 +113,7 @@ def process_annotation(context: Any, deps: Optional[List[str]], annot: str) -> s
|
||||
locals.update(sys.modules)
|
||||
while True:
|
||||
try:
|
||||
from typing import ForwardRef, evaluate_forward_ref # type: ignore
|
||||
from typing import ForwardRef, evaluate_forward_ref # type: ignore
|
||||
|
||||
dep_type = evaluate_forward_ref(
|
||||
ForwardRef(annot), globals=globals(), locals=locals
|
||||
@@ -527,7 +527,9 @@ def gen_class(file: Stream, class_obj: Type):
|
||||
elif inspect.isgetsetdescriptor(item):
|
||||
doc = TYPE_PATTERN.search(item.__doc__)
|
||||
if doc is None:
|
||||
raise ValueError("Didn't find type pattern in docstring")
|
||||
raise ValueError(
|
||||
f"Didn't find type pattern in docstring for {item.__name__}"
|
||||
)
|
||||
type_str = doc[1]
|
||||
|
||||
if type_str != class_obj.__name__:
|
||||
@@ -620,6 +622,13 @@ def gen(module: types.ModuleType, destpath: str):
|
||||
if shouldskip(item_name):
|
||||
continue
|
||||
|
||||
if "_" in item_name:
|
||||
segments = item_name.split("_")
|
||||
if hasattr(module, segments[0]) and inspect.isclass(
|
||||
getattr(module, segments[0])
|
||||
):
|
||||
continue
|
||||
|
||||
item = getattr(module, item_name)
|
||||
|
||||
if inspect.isclass(item):
|
||||
@@ -651,7 +660,7 @@ def gen(module: types.ModuleType, destpath: str):
|
||||
|
||||
deps = []
|
||||
|
||||
match: re.Match[str] = RTYPE_PATTERN.search(func_doc)
|
||||
match: Optional[re.Match[str]] = RTYPE_PATTERN.search(func_doc)
|
||||
if match is not None:
|
||||
add_dependencies(item, deps, match[1])
|
||||
ret = f" -> {unqualify(item, match[1])}"
|
||||
|
||||
@@ -172,6 +172,7 @@ def check_function(parent_name, objname, obj, source, global_func, typelist):
|
||||
default_val = p[2].lstrip()
|
||||
if len(default_val) > 0 and default_val[0] == '=':
|
||||
default_val = make_c_typeval(default_val[1:].strip(), False, typelist)
|
||||
default_val = default_val.replace('(', '\\(').replace(')', '\\)')
|
||||
|
||||
funcargs[0] += make_c_typeval(p[0], True, typelist) + ' ?' + p[1]
|
||||
funcargs[1] += make_c_typeval(p[0], False, typelist) + ' ' + p[1]
|
||||
@@ -262,9 +263,16 @@ for mod_name in check_mods:
|
||||
if args.verbose:
|
||||
print("===== Checks for {} =====".format(mod_name))
|
||||
for objname in dir(mod):
|
||||
if re.search('__|SWIG|ResourceId_Null|rdcarray_of|Structured.*List', objname):
|
||||
if re.search('__|SWIG|rdcarray_of|Structured.*List', objname):
|
||||
continue
|
||||
|
||||
if "_" in objname:
|
||||
segments = objname.split("_")
|
||||
if hasattr(mod, segments[0]) and inspect.isclass(
|
||||
getattr(mod, segments[0])
|
||||
):
|
||||
continue
|
||||
|
||||
# skip some functions that have special bindings and won't be easily found
|
||||
if objname in ['CreateRemoteServerConnection', 'DumpObject', 'GetSupportedDeviceProtocols']:
|
||||
if args.verbose:
|
||||
@@ -380,7 +388,7 @@ for mod_name in check_mods:
|
||||
print("Skipping {}.{}".format(objname, member_name))
|
||||
continue
|
||||
|
||||
if callable(member):
|
||||
if callable(member) or inspect.ismethoddescriptor(member):
|
||||
used_types = []
|
||||
|
||||
check_function(qualname, member_name, member, source, False, used_types)
|
||||
|
||||
Reference in New Issue
Block a user