Remove sip.setapi calls, they are not needed with PyQt5
PyQt4 used to support two APIs for several Qt classes (QString, QDate, QVariant, etc):
- API v2 (default for Python 3) automatically converted these Qt classes to native Python classes.
- API v1 (default for Python 2) did not do any conversion, and exposed the Qt classes to Python instead.
PyQt5 always uses API v2 for any version of Python. The only exception is QVariant, where it is possible to get a behavior similar to API v1, but v2 is still the default.
This was documented in the “Differences Between PyQt4 and PyQt5” section in PyQt5 docs. Now that section is removed, but can still be found in hg repository.
As we do not support PyQt4, we do not need these setapi
calls. Actually, I don’t understand why they were added in first place in 2a1bf73c — in 2017 PyQt4 was already not supported. Was that code copied from somewhere else?
This fixed the ModuleNotFoundError
messages I mentioned in !415 (merged).
Test Plan
I checked that Krita builds and runs fine with this change (with Python 3). I don’t have a Python 2 build of PyQt5 at hand, but I am sure it will work there too.
Formalities Checklist
-
I confirmed this builds. -
I confirmed Krita ran and the relevant functions work. -
I tested the relevant unit tests and can confirm they are not broken. (If not possible, don't hesitate to ask for help!) - I did not find any relevant unit tests.
-
I made sure my commits build individually and have good descriptions as per KDE guidelines. -
I made sure my code conforms to the standards set in the HACKING file. -
I can confirm the code is licensed and attributed appropriately, and that unattributed code is mine, as per KDE Licensing Policy.