History

scripts/get_abi.pl: Add filtering capabilities to rest output

This way, Sphinx ABI extension can parse symbols only once, while keep displaying results in separate files.

Mauro Carvalho Chehab committed 1 year ago

Commit 2a21d801 parent cc93e481 file · +15 −6Browse files

Unified · Split

scripts/lib/abi/abi_parser.py+15−6
@@ -160,6 +160,7 @@ class AbiParser: · 159 unmodified lines
160160 self.data[fdata.key] = {
161161 "what": [content],
162162 "file": [fdata.file_ref],
163+ "path": fdata.ftype,
163164 "line_no": fdata.ln,
164165 }
165166
@@ -182,8 +183,6 @@ class AbiParser: · 16 unmodified lines
182183 if new_what:
183184 fdata.label = ""
184185
185− self.data[fdata.key]["type"] = fdata.ftype
186−
187186 if "description" in self.data[fdata.key]:
188187 self.data[fdata.key]["description"] += "\n\n"
189188
@@ -299,6 +298,7 @@ class AbiParser: · 109 unmodified lines
299298 fdata.nametag = {}
300299 fdata.nametag["what"] = [f"File {path}/{basename}"]
301300 fdata.nametag["type"] = "File"
301+ fdata.nametag["path"] = fdata.ftype
302302 fdata.nametag["file"] = [fdata.file_ref]
303303 fdata.nametag["line_no"] = 1
304304 fdata.nametag["description"] = ""
@@ -427,7 +427,8 @@ class AbiParser: · 122 unmodified lines
427427
428428 return new_desc + "\n\n"
429429
430− def doc(self, output_in_txt=False, show_file=True):
430+ def doc(self, output_in_txt=False, show_symbols=True, show_file=True,
431+ filter_path=None):
431432 """Print ABI at stdout"""
432433
433434 part = None
@@ -435,12 +436,20 @@ class AbiParser: · 1 unmodified line
435436 key=lambda x: (x[1].get("type", ""),
436437 x[1].get("what"))):
437438
438− wtype = v.get("type", "Var")
439+ wtype = v.get("type", "Symbol")
439440 file_ref = v.get("file")
440441 names = v.get("what", [""])
441442
442− if not show_file and wtype == "File":
443− continue
443+ if wtype == "File":
444+ if not show_file:
445+ continue
446+ else:
447+ if not show_symbols:
448+ continue
449+
450+ if filter_path:
451+ if v.get("path") != filter_path:
452+ continue
444453
445454 msg = ""
446455