#592 Package KWidgetsAddons Python bindings
Closed: Duplicate by aleasto. Opened by nicolasfella.

KWidgetsAddons got Python bindings with https://invent.kde.org/frameworks/kwidgetsaddons/-/merge_requests/258, and more Frameworks will follow soon.

I want to make sure those can be properly packaged, so please try and report any problems


Most of it should be straight-forward, but one thing I'm not sure about is the install location of the binding's .so: https://invent.kde.org/frameworks/kunitconversion/-/merge_requests/48/diffs#fc0dc9e749cd09b1cb53e0c78ca9a61a36e3c8f8_0_34

I assume it should go to some site-packages dir, but I'm not sure we can determine the right one upstream

I tried and faced two issues:

https://invent.kde.org/frameworks/extra-cmake-modules/-/blob/master/modules/ECMGeneratePythonBindings.cmake#L175
python -m build uses venv+pip and fails in an environment without the internet. Solved by adding --no-isolation

https://invent.kde.org/frameworks/extra-cmake-modules/-/blob/master/modules/ECMGeneratePythonBindings.cmake#L88
sets an invalid rpath:

ERROR   0002: file '/usr/lib64/python3.13/site-packages/KCoreAddons.cpython-313-x86_64-linux-gnu.so' contains an invalid runpath '/builddir/build/BUILD/kf6-kcoreaddons-6.9.0_6.gite007401-build/kcoreaddons-e007401520085181141b70b3ea97873596c4dcfa/python' in [/usr/lib/python3.13/site-packages/shiboken6:/builddir/build/BUILD/kf6-kcoreaddons-6.9.0_6.gite007401-build/kcoreaddons-e007401520085181141b70b3ea97873596c4dcfa/python]

solved by removing ${CMAKE_CURRENT_SOURCE_DIR} from the line.

Thanks!

I tried and faced two issues:

https://invent.kde.org/frameworks/extra-cmake-modules/-/blob/master/modules/ECMGeneratePythonBindings.cmake#L175
python -m build uses venv+pip and fails in an environment without the internet. Solved by adding --no-isolation

As far as I can tell --no-isolation is the right thing to use when creating distro packages anyway. https://invent.kde.org/frameworks/extra-cmake-modules/-/merge_requests/492

https://invent.kde.org/frameworks/extra-cmake-modules/-/blob/master/modules/ECMGeneratePythonBindings.cmake#L88
sets an invalid rpath:

ERROR 0002: file '/usr/lib64/python3.13/site-packages/KCoreAddons.cpython-313-x86_64-linux-gnu.so' contains an invalid runpath '/builddir/build/BUILD/kf6-kcoreaddons-6.9.0_6.gite007401-build/kcoreaddons-e007401520085181141b70b3ea97873596c4dcfa/python' in [/usr/lib/python3.13/site-packages/shiboken6:/builddir/build/BUILD/kf6-kcoreaddons-6.9.0_6.gite007401-build/kcoreaddons-e007401520085181141b70b3ea97873596c4dcfa/python]

solved by removing ${CMAKE_CURRENT_SOURCE_DIR} from the line.

Please check with https://invent.kde.org/frameworks/extra-cmake-modules/-/merge_requests/491

I tried and faced two issues:

https://invent.kde.org/frameworks/extra-cmake-modules/-/blob/master/modules/ECMGeneratePythonBindings.cmake#L175
python -m build uses venv+pip and fails in an environment without the internet. Solved by adding --no-isolation

Is the wheel even relevant for distro packaging? The installed .so is enough, no?

It shouldn't be unless you're trying to use the pyproject method of building and installing it.

FYI @churchyard to give feedback about Python bindings.

What kind of feedback?

Building and installing Python bindings with cmake and friends is a nightmare to me. If at all possible, make it a pip-installable package that uses the installed KWidgetsAddons under the hood. That allows Fedora to use the standardized Python macros to package it.

Metadata Update from @aleasto:
- Issue close_status updated to: Duplicate
- Issue status updated to: Closed (was: Open)

I guess we're now tracking this in https://pagure.io/fedora-kde/SIG/issue/605

Metadata