Skip to content

pyqt5_to_pyqt6.py: Some known incompabilities do not lead to error exit code #62559

Description

@kannes

Feature description

pyqt5_to_pyqt6.py does return an error exit code if it alters (or would alter) files. This can be used as an indicator that the current code base is known to not be Qt6 compatible.

This is used by e.g. https://gitlab.com/Oslandia/qgis/pyqgis-4-checker to check merge requests in CI.

The script does have some more knowledge though, which currently is only logged as a warnings but not communicated as error exit code:

import_warnings = {
"QRegExp": "QRegExp is removed in Qt6, please use QRegularExpression for Qt5/Qt6 compatibility"
}

if name.name in import_warnings:
logging.warning(f"{filename}: {import_warnings[name.name]}")
if name.name == "resources_rc":
logging.warning(
f"{filename}:{_node.lineno}:{_node.col_offset} - WARNING: support for compiled resources "
"is removed in Qt6. Directly load icon resources by file path and load UI fields using "
"uic.loadUiType by file path instead.\n"
)

It would be great if those too would result in error exit codes so that automatic testing could catch them more easily.

Additional context

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    BugEither a bug report, or a bug fix. Let's hope for the latter!

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions