[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Python module installation with cmake



Hi,

I'm looking for help with a regression in cmake 3.27, that is currently producing incorrect module installation paths for the Python package Uranium: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=1042157

Uranium's cmake script uses the cmake variable Python_SITELIB to determine the installation path for Python modules, and that used to work correctly up until cmake 3.26. In 3.27, the value of this variable has changed, and it now points to /usr/local, which seems wrong to me. Furthermore, it includes the full Python version, which also doesn't look right:

In 3.26.4-4, Python_SITELIB is /usr/lib/python3/dist-packages, and the documentation[1] says: > Information returned by distutils.sysconfig.get_python_lib(plat_specific=False,standard_lib=False) or else sysconfig.get_path('purelib').

In 3.27.1-1, it's /usr/local/lib/python3.11/dist-packages, coming from[2]:
> Information returned by sysconfig.get_path('purelib').

There don't seem to be any other useful cmake variables that could be used. The relevant cmake script parts look like this:

####
if(NOT DEFINED Python_SITELIB_LOCAL)
    set(Python_SITELIB_LOCAL
            "${Python_SITELIB}"
CACHE PATH "Local alternative site-package location to install Uranium" FORCE)
endif()
install(DIRECTORY UM DESTINATION "${Python_SITELIB_LOCAL}")
####

I do think this is a regression in cmake, but perhaps something was wrong with the script in the first place and only showed up now?

Can someone help with sorting this issue out?

Thanks,
Gregor

[1] https://cmake.org/cmake/help/v3.26/module/FindPython.html
[2] https://cmake.org/cmake/help/v3.27/module/FindPython.html


Reply to: