Skip to content

python: Bump maximum version for Python 3 module generator check.

Michael Pyne requested to merge work/mpyne-fix-py3-ver-check into master

The proximate problem is that the Python Module generator cmake script has started failing for people with Python 3.10, which a CMake backtrace pointing into FindPythonModuleGeneration.cmake with an error of the form "The max python version in PythonModuleGeneration must be updated."

At least one distro has addressed this by simply patching out modules that happen to use this CMake module (Gentoo).

From what I can tell and the testing I've done, the cause is pretty simple: The CMake script attempts to find the best Python 3 version by starting from an impossible version and working backwards until it finds a version that is installed.

As a sanity check, if the "impossible" version is actually present, it aborts. But this appears to be just a sanity check, and not any sort of guard against buggy version handling code later.

While the best fix is probably to start from a known good version and move up until we stop finding better versions, there's problems here (e.g. a user with 3.6 and 3.8 installed would fail to see 3.7 and so be left with 3.6 as the "best" match), so I opted just to increase the max version significantly, and improve the documentation as to what's happening and whether it is safe to repeat the step again later.

Reproducing

I believe you need SIP installed and present to run into this part of the code. And obviously Python 3.10 (if you skip straight to Python 3.11 you shouldn't run into the fatal error but you'll be capped to Python 3.9 or lower).

Testing

I've tested by building and installing ECM after running into this bug, and then running a full kdesrc-build for my KF5/Plasma 5 installation.

All modules build including the ones that Gentoo patched out support for Python modules like kcoreaddons.

Edited by Michael Pyne

Merge request reports