What is the bug or the crash?
pyqt5_to_pyqt6.py, at least when run using Oslandia's Docker, produces bad code with the example below.
I did not test this on a non-Docker Qt6 system.
Steps to reproduce the issue
Consider a file with this code inside:
if True:
...
from PyQt5.QtCore import QSettings
This is valid Python code and I can execute it with an interpreter just fine.
docker run --rm -v "$(pwd):/home/pyqgisdev/" registry.gitlab.com/oslandia/qgis/pyqgis-4-checker/pyqgis-qt-checker:latest pyqt5_to_pyqt6.py . produces
if True:
...
fromqgis.PyQtqgis.PyQt.QtCore import QSettings
where fromqgis.PyQtqgis.PyQt.QtCore is broken, it should be from qgis.PyQt.Qtcore.
Versions
master
Supported QGIS version
New profile
Additional context
When I test it in a Qt5 environment I get an assertion error
./scripts/pyqt5_to_pyqt6/pyqt5_to_pyqt6.py /tmp/a 2 ✘
WARNING:root:WARNING: PyQt5 has been found. It may result in wrong behavior.
Traceback (most recent call last):
File "/home/foo/qgis/./scripts/pyqt5_to_pyqt6/pyqt5_to_pyqt6.py", line 903, in <module>
raise SystemExit(main())
~~~~^^
File "/home/foo/qgis/./scripts/pyqt5_to_pyqt6/pyqt5_to_pyqt6.py", line 898, in main
ret |= fix_file(filename, not args.qgis3_incompatible_changes, dry_run)
~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/foo/qgis/./scripts/pyqt5_to_pyqt6/pyqt5_to_pyqt6.py", line 719, in fix_file
assert tokens[i + 2].src == "PyQt5"
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
AssertionError
What is the bug or the crash?
pyqt5_to_pyqt6.py, at least when run using Oslandia's Docker, produces bad code with the example below.I did not test this on a non-Docker Qt6 system.
Steps to reproduce the issue
Consider a file with this code inside:
This is valid Python code and I can execute it with an interpreter just fine.
docker run --rm -v "$(pwd):/home/pyqgisdev/" registry.gitlab.com/oslandia/qgis/pyqgis-4-checker/pyqgis-qt-checker:latest pyqt5_to_pyqt6.py .produceswhere
fromqgis.PyQtqgis.PyQt.QtCoreis broken, it should befrom qgis.PyQt.Qtcore.Versions
master
Supported QGIS version
New profile
Additional context
When I test it in a Qt5 environment I get an assertion error