Skip to content

Fix ECM on systems without PyQt5 on Python 2

Nyan Pasu requested to merge nyanpasu/extra-cmake-modules:fix-python-3 into master

Arch Linux has a Python 2 package, but no mainline python2-pyqt5 package (python-pyqt5 only supplies a Python 3 package). When running ECM on Arch Linux with Python 2 installed, ECM calls sip_generator.py --self-check with Python 2 first, which passes. Then it calls run-sip.py (which depends on PyQt5) with Python 2, which fails with the following error (though ECM should be preferring 3 over 2 anyway):

Traceback (most recent call last):
  File "/usr/share/ECM/find-modules/run-sip.py", line 10, in <module>
    from PyQt5.Qt import PYQT_CONFIGURATION
ImportError: No module named PyQt5.Qt

This MR makes FindPythonModuleGeneration.cmake prefer Python 3 over 2, and makes sip_generator.py --self-check ensure PyQt5 is present when picking a Python version for run-sip.py.

Edited by Nyan Pasu

Merge request reports