Bug 507459 - Generated Python binding files installed in the wrong place for Debian systems
Summary: Generated Python binding files installed in the wrong place for Debian systems
Status: REPORTED
Alias: None
Product: frameworks-kguiaddons
Classification: Frameworks and Libraries
Component: general (other bugs)
Version First Reported In: unspecified
Platform: Compiled Sources Linux
: NOR normal
Target Milestone: ---
Assignee: kdelibs bugs
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2025-07-24 20:47 UTC by bluescreenavenger
Modified: 2025-07-24 20:47 UTC (History)
0 users

See Also:
Latest Commit:
Version Fixed/Implemented In:
Sentry Crash Report:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description bluescreenavenger 2025-07-24 20:47:25 UTC
This is ALL 8 (at time of writing) frameworks that install python bindings, not just kguiaddons, I am reporting against kguiaddons because it looks like kguiaddons was first

SUMMARY
The generated python binding files are installed under $INSTALLDIR/local/lib/python3.13/dist-packages/ or in my case /opt/local/lib/python3.13/dist-packages/

Debian/Ubuntu tends to not install Python files under /$INSTALLDIR/local/lib/ but under /$INSTALLDIR/lib/python3.13/site-packages/ and I can validate with "apt-file search /usr/local/lib"

Debian, seems to have its own way of handing Python that is unique to other distros AFAIK

You might want to use something like this, and I only got it through grepping, and finding this is how fontconfig installs their bindings, they use sysconfig.get_python_lib from distutils. I don't know the arguments they are passing the 0's to, I am not really 100% familiar with it. But yeah. and you might also want to append the project name at the end I think (like $INSTALLDIR/local/lib/python3.13/dist-packages/KGuiAddons/KGuiAddons.cpython-313-x86_64-linux-gnu.so), some packages do that, although not all do, so maybe that is not required
```
diff --git a/python/CMakeLists.txt b/python/CMakeLists.txt
index e97b173..23e924f 100644
--- a/python/CMakeLists.txt
+++ b/python/CMakeLists.txt
@@ -31,7 +31,7 @@ ecm_generate_python_bindings(
 
 target_link_libraries(${bindings_library} PRIVATE KF6Notifications)
 
-execute_process(COMMAND ${Python_EXECUTABLE} -Esc "import sysconfig; print(sysconfig.get_path('platlib', vars={'platbase': '${CMAKE_INSTALL_PREFIX}', 'base': '${CMAKE_INSTALL_PREFIX}'}))" OUTPUT_VARIABLE sysconfig_output)
+execute_process(COMMAND ${Python_EXECUTABLE} -Esc "from distutils import sysconfig; print(sysconfig.get_python_lib(0, 0, '${CMAKE_INSTALL_PREFIX}'))" OUTPUT_VARIABLE sysconfig_output OUTPUT_VARIABLE sysconfig_output)
 string(STRIP ${sysconfig_output} PYTHON_INSTALL_DIR)
 
 install(TARGETS ${bindings_library} LIBRARY DESTINATION "${PYTHON_INSTALL_DIR}")
```

Right now, Ubuntu seems to have the latest one where building the Python bindings is turned on by default, looks like they explicitly disabled it for now, but when they go to re-enable it it might be an issue


SOFTWARE/OS VERSIONS
Operating System: Debian
KDE Plasma Version: 6.4.80
KDE Frameworks Version: 6.17.0
Qt Version: 6.9.2
Kernel Version: 6.15.7 (64-bit)