From patchwork Tue May 17 14:33:14 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tomi Valkeinen X-Patchwork-Id: 15926 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 C0999C3256 for ; Tue, 17 May 2022 14:33:55 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 83EE86041E; Tue, 17 May 2022 16:33:55 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org; s=mail; t=1652798035; bh=OFNUJIPjBd8sjbcQV4mr3FTMsE4thcfDX+7+k+bf3BU=; h=To:Date:In-Reply-To:References:Subject:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To: From; b=kZywUa3tSBr2U4npmphvyJOyYAkzYdfmcu/hqqyNBYAfCF1X6Ttd9H9Yk/myIw4NX v0NhkZazHtlH39H6DsqmTE9BZQvBMaBOyL6UbK8PbjkBfjU/e9Qu8lVOxZlM2ghL6L yxUzCMAS5dCQDmXS7dWG3uibFUiJ53U+sY+fRq7GR3IORPPdgCqvCzxWNDPyO62Lfg U7fY+g1AFt5iM9s1GR9bVxkPFnNSCAJ4nfLa90+BkNVpNDXPfg3LnnehOYDZx2Z7Lt CyEx56Z31xC+xap6i+XjOOuiVfn8ZctP4TjuBXlFlFpQfm7iQNQM2EOhtH5zkyeDE6 XyLLoUug8vNiw== Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [IPv6:2001:4b98:dc2:55:216:3eff:fef7:d647]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 744736041E for ; Tue, 17 May 2022 16:33:52 +0200 (CEST) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (1024-bit key; unprotected) header.d=ideasonboard.com header.i=@ideasonboard.com header.b="HAw3lSbR"; dkim-atps=neutral Received: from deskari.lan (91-156-85-209.elisa-laajakaista.fi [91.156.85.209]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id DC7968D3; Tue, 17 May 2022 16:33:51 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1652798032; bh=OFNUJIPjBd8sjbcQV4mr3FTMsE4thcfDX+7+k+bf3BU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=HAw3lSbRv46v1Ato8MzIoThtQj8QcKWImmsdOOSWYcMIDEhy1W1yzZ+PLZmIyt4D3 e+cJC0TIZA+gAEn+sFGFgQn0rGLdpIJURtreGuD1M9SqpJbHZLTW5DTsibdE2fe7iT 7OBPy6DP81pLPgw5xq8IXRTOSlEGsPKV7GRoTDCE= To: libcamera-devel@lists.libcamera.org, David Plowman , Kieran Bingham , Laurent Pinchart , Jacopo Mondi Date: Tue, 17 May 2022 17:33:14 +0300 Message-Id: <20220517143325.71784-3-tomi.valkeinen@ideasonboard.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220517143325.71784-1-tomi.valkeinen@ideasonboard.com> References: <20220517143325.71784-1-tomi.valkeinen@ideasonboard.com> MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH v2 02/13] py: meson: add pystubs build target 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: Tomi Valkeinen via libcamera-devel From: Tomi Valkeinen Reply-To: Tomi Valkeinen Errors-To: libcamera-devel-bounces@lists.libcamera.org Sender: "libcamera-devel" Add a 'pystubs' build target for building the python stubs. For now this needs to be ran manually. I didn't figure out how to generate the stubs after the libcamera bindings are built. Signed-off-by: Tomi Valkeinen Reviewed-by: Laurent Pinchart Reviewed-by: Kieran Bingham --- src/py/libcamera/meson.build | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/src/py/libcamera/meson.build b/src/py/libcamera/meson.build index 38f619d0..32e74504 100644 --- a/src/py/libcamera/meson.build +++ b/src/py/libcamera/meson.build @@ -60,6 +60,18 @@ run_command('ln', '-fsT', '../../../../src/py/libcamera/__init__.py', install_data(['__init__.py'], install_dir : destdir) -# \todo Generate stubs when building. See https://peps.python.org/pep-0484/#stub-files +# \todo Generate stubs when building, and install them. +# See https://peps.python.org/pep-0484/#stub-files # Note: Depends on pybind11-stubgen. To generate pylibcamera stubs: # $ PYTHONPATH=build/src/py pybind11-stubgen --no-setup-py -o build/src/py libcamera +# The target below can be ran manually, but how to create a meson target that +# is run if pycamera is built? + +stubgen = find_program('pybind11-stubgen', required : false) + +if stubgen.found() + run_target('pystubs', + depends: pycamera, + env: {'PYTHONPATH': meson.project_build_root() / 'src' / 'py'}, + command: [stubgen, '--no-setup-py', '-o', meson.project_build_root() / 'src' / 'py', 'libcamera']) +endif