@@ -62,7 +62,7 @@ if meson.is_cross_build()
# module. There's work in progress to fix this, based on PEP 739
# (https://github.com/mesonbuild/meson/pull/14657). While waiting for this
# to become available, work around the issue by using shared_module().
- destdir = get_option('libdir') / ('python' + py3.language_version()) / 'site-packages' / 'libcamera'
+ destdir = py3.get_install_dir(subdir : 'libcamera', pure : false)
pycamera = shared_module('_libcamera',
pycamera_sources,
@@ -72,9 +72,6 @@ if meson.is_cross_build()
name_prefix : '',
dependencies : pycamera_deps,
cpp_args : pycamera_args)
- install_data(['__init__.py'],
- install_dir : destdir,
- install_tag : 'python-runtime')
else
pycamera = py3.extension_module('_libcamera',
pycamera_sources,
@@ -82,11 +79,12 @@ else
subdir : 'libcamera',
dependencies : pycamera_deps,
cpp_args : pycamera_args)
- py3.install_sources(['__init__.py'],
- subdir : 'libcamera',
- pure : false)
endif
+py3.install_sources(['__init__.py'],
+ subdir : 'libcamera',
+ pure : false)
+
# Create symlinks from the build dir to the source dir so that we can use the
# Python module directly from the build dir.
libcamera uses the meson python module to handle native compilation of Python extension modules, and uses the shared_module() function when cross-compiling due to an issue in the python module. The difference between native and cross compilation also extends to the installation path: native compilation lets the python module handle the paths, while cross compilation constructs a path manually using a heuristic based on the Python version and hardcoded components. This manually-constructed installation path is problematic for cross compilation for the same reason it caused issue when used for native compilation: it is not guaranteed to be right, and it can't be overridden by users. Switch to obtaining the installation path from the meson python module for cross-compilation as well. This also prepares for usage of py.extension_module() once the file suffix issue will be fixed in meson. On Debian 13, this change replaces the incorrect path /usr/local/lib/python3.12/site-packages/libcamera with the still (but differently) incorrect /usr/local/lib/python3/dist-packages/libcamera. Future fixes in meson to address this issue will make the path correct by default. When the path calculated by the python module is not correct, it can now be overridden by the user through the meson python.platlibdir configuration variable. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> --- src/py/libcamera/meson.build | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-)