diff --git a/scripts/sipify.py b/scripts/sipify.py index 740d4718168c..1bbfa374d80f 100755 --- a/scripts/sipify.py +++ b/scripts/sipify.py @@ -42,7 +42,11 @@ class MultiLineType(Enum): parser = argparse.ArgumentParser(description="Convert header file to SIP and Python") parser.add_argument("-debug", action="store_true", help="Enable debug mode") parser.add_argument("-qt6", action="store_true", help="Enable Qt6 mode") -parser.add_argument("-generate_deprecated_message", action="store_true", help="Generate sip files with deprecated messages (supported only in SIP > 6.9.0)") +parser.add_argument( + "-generate_deprecated_message", + action="store_true", + help="Generate sip files with deprecated messages (supported only in SIP > 6.9.0)", +) parser.add_argument("-sip_output", help="SIP output file") parser.add_argument("-python_output", help="Python output file") parser.add_argument("-class_map", help="Class map file") @@ -891,7 +895,9 @@ def process_doxygen_line(line: str) -> str: version = version[:-1] depr_line = f"\n.. deprecated:: {version}" message = deprecated_match.group("DEPR_MESSAGE") - CONTEXT.deprecated_message = f"Since {version}. {process_deprecated_message(message)}" + CONTEXT.deprecated_message = ( + f"Since {version}. {process_deprecated_message(message)}" + ) if message: depr_line += "\n" depr_line += "\n".join(f"\n {_m}" for _m in message.split("\n")) @@ -1172,7 +1178,9 @@ def fix_annotations(line): if "SIP_DEPRECATED" in line: if CONTEXT.deprecated_message is None: - exit_with_error(f"Error in file {CONTEXT.header_file}: missing deprecated message for SIP_DEPRECATED instruction on line {CONTEXT.line_idx}. Please add \\deprecated instruction") + exit_with_error( + f"Error in file {CONTEXT.header_file}: missing deprecated message for SIP_DEPRECATED instruction on line {CONTEXT.line_idx}. Please add \\deprecated instruction" + ) # Printed annotations replacements = { @@ -1208,7 +1216,9 @@ def fix_annotations(line): if CONTEXT.generate_deprecated_message: # check deprecated message is not empty - replacements[r"\bSIP_DEPRECATED\b"] = f'/Deprecated="{CONTEXT.deprecated_message}"/' + replacements[r"\bSIP_DEPRECATED\b"] = ( + f'/Deprecated="{CONTEXT.deprecated_message}"/' + ) else: replacements[r"\bSIP_DEPRECATED\b"] = f"/Deprecated/" @@ -1218,9 +1228,8 @@ def fix_annotations(line): # Combine multiple annotations while True: new_line = re.sub( - r'/([\w,]+(="?[^"]+"?)?)/\s*/([\w,]+(="?[^"]+"?)?]?)/', - r"/\1,\3/", - line) + r'/([\w,]+(="?[^"]+"?)?)/\s*/([\w,]+(="?[^"]+"?)?]?)/', r"/\1,\3/", line + ) if new_line == line: break line = new_line