kdev-python: Use CMake FindPython3

Casian Andrei casian at candrei.ro
Mon Jan 8 12:50:02 GMT 2024


La 04.01.2024 16:37, Francis Herne a scris:

> On 2024-01-03 14:31, Casian Andrei wrote:
>> Use FindPython3 instead of FindPythonInterp and FindPythonLibs
>>
>> Fixes CMake warning regarding CMP0148 - deprecation of
>> FindPythonInterp and FindPythonLibs.
>>
>> Initially tested using a python3.12, but kdevelop crashes and there
>> are kdev-python errors in the logs, so kept max version to 3.11.
>>
>> Tested with a local compiled python3.9. When the python3.9 was
>> compiled without --enable-shared, CMake didn't work, as expected. When
>> compiled with --enable-shared, CMake worked fine. Built ok, but for
>> some reason tried to link kdevpythonlanguagesupport.so to a
>> nonexistent python3.11 library.
>>
>> Installed a python3.11 which worked fine with kdevelop-python.
>>
>> I assume that issue linking to a nonexistent python3.11 was not
>> because of a problem with these changes.
>>
>> ---
>>
>> Because I haven't contributed to KDE for many years now, it would take
>> a lot of time to get the accounts and setups and learn how things are
>> done now.
>>
>> I hope you are able to review and commit if ok.
>>
>> Attaching the patch.
>
> Thanks for the patch.
>
> Nitpick: please use 3.11 as upper bound (assuming that works) rather 
> than 3.11.7 in case there's another patch release. These are very 
> unlikely to break kdev-python.
> The dependency on 3.4.3 was due to a particularly stupid series of 
> events that hopefully won't repeat.
>
> I'm concerned that the "issue linking to a nonexistent python3.11" 
> might be due to you having a Python 3.11 interpreter installed, but 
> not with corresponding libs? This will explicitly fail with the old 
> checks, where the comment is: "# Find libraries that match the found 
> interpreter (mismatched versions not supported)."
>
> If CMake's new FindPython3 is smart enough it would return the highest 
> version matching both required components, but I've learned to have 
> very little faith in CMake modules doing the right thing in 
> non-obvious situations.
>
> Yours,
> -Francis Herne

I have managed to solve all issues - much faster using this new fancy AI 
technology.

Regarding the version range, I noticed that putting 3.11 translates into 
3.11.0 for CMake, so it refuses 3.11.5, for example. The correct setting 
is 3.4.3...<3.12. Found that this version range needs at least CMake 
3.19 (find_package documentation, search for "[version] argument").

The issue with that linking to python3.11 was because before the distro 
upgrade, it installed kdev-python in /usr/local, but now the prefix is 
in /usr . So, when looking at libkdevpythonlanguagesupport.so, the 
linker found the older libkdevpythonparser.so from /usr/local which 
needed the old Python libs. I didn't realize those libraries were still 
there, in a location different from the plugins.

I guess it should be fine now.

Attaching updated patch.


Thank you!

Regards,

Casian

-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-Use-FindPython3-instead-of-FindPythonInterp-and-Find.patch
Type: text/x-patch
Size: 4347 bytes
Desc: not available
URL: <http://mail.kde.org/pipermail/kdevelop-devel/attachments/20240108/eb7020d8/attachment.bin>


More information about the KDevelop-devel mailing list