aboutsummaryrefslogtreecommitdiffstats
path: root/sources/shiboken6/doc/scripts/patch_qhp.py
diff options
context:
space:
mode:
Diffstat (limited to 'sources/shiboken6/doc/scripts/patch_qhp.py')
-rw-r--r--sources/shiboken6/doc/scripts/patch_qhp.py16
1 files changed, 16 insertions, 0 deletions
diff --git a/sources/shiboken6/doc/scripts/patch_qhp.py b/sources/shiboken6/doc/scripts/patch_qhp.py
index 1f86162a9..750789698 100644
--- a/sources/shiboken6/doc/scripts/patch_qhp.py
+++ b/sources/shiboken6/doc/scripts/patch_qhp.py
@@ -14,9 +14,13 @@ registering the documentation in Qt Assistant."""
VIRTUAL_FOLDER_PATTERN = re.compile("(^.*virtualFolder.)doc(.*$)")
+# Strip "PySide6.QtModule." from index entries
+INDEX_CLASS_PATTERN = re.compile(r'^(\s*<keyword name=")PySide6\.[^.]+\.(.*\(class in .*)$')
+INDEX_METHOD_PATTERN = re.compile(r'^(\s+<keyword name=".* \()PySide6\.[^.]+\.(.*>)$')
virtual_folder = ""
+strip_pyside_module = False
def process_line(line):
@@ -25,6 +29,15 @@ def process_line(line):
if match:
print(f"{match.group(1)}{virtual_folder}{match.group(2)}")
return
+ if strip_pyside_module:
+ match = INDEX_METHOD_PATTERN.match(line)
+ if match:
+ print(f"{match.group(1)}{match.group(2)}")
+ return
+ match = INDEX_CLASS_PATTERN.match(line)
+ if match:
+ print(f"{match.group(1)}{match.group(2)}")
+ return
sys.stdout.write(line)
@@ -33,9 +46,12 @@ if __name__ == '__main__':
formatter_class=RawTextHelpFormatter)
arg_parser.add_argument('-v', '--vfolder', type=str,
help='String to be injected into the Qhp file.')
+ arg_parser.add_argument("--pyside", "-p", action="store_true",
+ help="Strip the PySide module path off the index entries.")
arg_parser.add_argument("file", type=str, help='Qhp filename.')
options = arg_parser.parse_args()
virtual_folder = options.vfolder
+ strip_pyside_module = options.pyside
try:
with fileinput.input(options.file, inplace=True,