From patchwork Sun May 15 17:02:53 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chris Mayo X-Patchwork-Id: 15905 Return-Path: X-Original-To: parsemail@patchwork.libcamera.org Delivered-To: parsemail@patchwork.libcamera.org Received: from lancelot.ideasonboard.com (lancelot.ideasonboard.com [92.243.16.209]) by patchwork.libcamera.org (Postfix) with ESMTPS id 445D4C3256 for ; Sun, 15 May 2022 17:03:09 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 6085E6565A; Sun, 15 May 2022 19:03:08 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org; s=mail; t=1652634188; bh=Vxq8xhjVn04uCvDeWm8Mhuue+xDbqAKLEXWot7L7f3w=; h=To:Date:Subject:List-Id:List-Unsubscribe:List-Archive:List-Post: List-Help:List-Subscribe:From:Reply-To:From; b=AWuJ+HhA906d7bQUROkDE9ASexGWZVZVm9aOLd70F4hBbMcqsTc2ENa7Crdar1ekX nv/Vpw+vFO9X5NVraRoAD8l2HcyGgE3MR/qdEYFJ162cKSbd+ohq9CQDubp2tZj6dS YxsXbswXyckadvM3McBKGTo++sAPTAEyQ0OXupxs/iCRKr6120r44C9veCNZXfMzy+ GzDc8HsPZjxs22AqfFptCPT6hfLISc1BVDG8aLVan6tkWKRs7afmChT3b2/ekxE5H0 RZWmPyXC0K9DQGXeVI8rpotLoEjsWTbXSYRZ5NR3su/7rHhuhEbJ/Fzxema75ypMkb AXoouQ30KUm/A== Received: from avasout-ptp-004.plus.net (avasout-ptp-004.plus.net [84.93.230.250]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 94EFB65655 for ; Sun, 15 May 2022 19:03:06 +0200 (CEST) Received: from mailserver ([84.92.36.196]) by smtp with ESMTP id qHdznWwSUAcBnqHe0nNfJi; Sun, 15 May 2022 18:03:05 +0100 X-Clacks-Overhead: "GNU Terry Pratchett" X-CM-Score: 0.00 X-CNFS-Analysis: v=2.4 cv=JPUoDuGb c=1 sm=1 tr=0 ts=62813249 a=9joFju3sQCjqEQe1SErgvA==:117 a=9joFju3sQCjqEQe1SErgvA==:17 a=x7bEGLp0ZPQA:10 a=YbTMELGUhT8A:10 a=pGLkceISAAAA:8 a=8AHkEIZyAAAA:8 a=udgzeoR2GaE-y9cFH8cA:9 To: libcamera-devel@lists.libcamera.org Date: Sun, 15 May 2022 18:02:53 +0100 Message-Id: <20220515170253.53075-1-aklhfex@gmail.com> X-Mailer: git-send-email 2.35.1 MIME-Version: 1.0 X-CMAE-Envelope: MS4xfI85J8zw2u6ka3rqzjkOZAj7lopM1Rd+fxY0EM2HNGmxAXIEiDLnql50TWktl93LS9rBIZlIVSsrciiy5C0xYFImjfblBPuNdPciuPxdIdpM1IDSH333 utLN4lwEfRO32g1tNPMuUCJoKnOKMJVq5wmqmkqjU57IDaWzqRGjMb9IxEWLEnRbmdQyrFye+0W4W4eHyMsqTv4BdtVxGYVYXwM= Subject: [libcamera-devel] [PATCH] py: Use Meson python module X-BeenThere: libcamera-devel@lists.libcamera.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Patchwork-Original-From: Chris Mayo via libcamera-devel From: Chris Mayo Reply-To: Chris Mayo Errors-To: libcamera-devel-bounces@lists.libcamera.org Sender: "libcamera-devel" Detection with dependency('python3') can fail because not all distributions install python-3.pc. Installation is invalid if site-packages is not below get_option('libdir'). Signed-off-by: Chris Mayo --- src/py/libcamera/meson.build | 27 ++++++++++++--------------- 1 file changed, 12 insertions(+), 15 deletions(-) diff --git a/src/py/libcamera/meson.build b/src/py/libcamera/meson.build index 0cd7c75b..130c1be6 100644 --- a/src/py/libcamera/meson.build +++ b/src/py/libcamera/meson.build @@ -1,6 +1,8 @@ # SPDX-License-Identifier: CC0-1.0 -py3_dep = dependency('python3', required : get_option('pycamera')) +pymod = import('python') +py3 = pymod.find_installation('python3') +py3_dep = py3.dependency(required : get_option('pycamera')) if not py3_dep.found() pycamera_enabled = false @@ -44,21 +46,16 @@ pycamera_args = [ '-DLIBCAMERA_BASE_PRIVATE', ] -destdir = get_option('libdir') / ('python' + py3_dep.version()) / 'site-packages' / 'libcamera' +py3.extension_module('_libcamera', + pycamera_sources, + install : true, + dependencies : pycamera_deps, + cpp_args : pycamera_args, + subdir : 'libcamera') -pycamera = shared_module('_libcamera', - pycamera_sources, - install : true, - install_dir : destdir, - name_prefix : '', - dependencies : pycamera_deps, - cpp_args : pycamera_args) - -run_command('ln', '-fsT', '../../../../src/py/libcamera/__init__.py', - meson.current_build_dir() / '__init__.py', - check: true) - -install_data(['__init__.py'], install_dir : destdir) +py3.install_sources('__init__.py', + pure : false, + subdir : 'libcamera') # \todo Generate stubs when building. See https://peps.python.org/pep-0484/#stub-files # Note: Depends on pybind11-stubgen. To generate pylibcamera stubs: