From patchwork Mon May 16 14:10:10 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tomi Valkeinen X-Patchwork-Id: 15908 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 3165EC326C for ; Mon, 16 May 2022 14:10:54 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id D6F3D65664; Mon, 16 May 2022 16:10:50 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org; s=mail; t=1652710250; bh=MbwnSfF0sSwNjlsdM6Fc3w1mndHsQnPSB9jGgx82smk=; 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=zPRrUsFmYQMfQPotliXjiQZipGPYC1ZPjxrWQ5fr/4GcPF/oF7UPvki3WjoWOFN51 rWyyuKJdCpCOij5sxLouhdGk8+bZBiPt6CtBc5q20UAnViAGsoGPeztKday5F4cKp/ DayqQsTlWXGUkZ8GRDBWdARxQVW02ddVlpPIujgiUblBiEVBSNjdt+DxqVbzRxPItH 1R7V/rq5PLex9yf52JMBxpV9qluNIgOFooMzp79BXgAYuD7hWjhhTuGOIaPxWGs87A 4oVwSlYTp0x0dmaWBhZlQEK56SRm9lVw5RnwchJ0yHc+OBWB6vU95kx2Zhsh8FP/t/ 9/Ngjp1Q4H3Qg== 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 BC78965654 for ; Mon, 16 May 2022 16:10:48 +0200 (CEST) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (1024-bit key; unprotected) header.d=ideasonboard.com header.i=@ideasonboard.com header.b="N2kJTiOM"; 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 30A9E563; Mon, 16 May 2022 16:10:48 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1652710248; bh=MbwnSfF0sSwNjlsdM6Fc3w1mndHsQnPSB9jGgx82smk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=N2kJTiOMHkDPohc/0y461NZScHdfeSNKIjhCsVx+8+JArJxAC8Yr/cwfI7hrSb46m MV9eWHbUWuZAcFvAhWn/2K7yyH6ZsPvMYxCfPxsIG09+xt9zu3c6zOk26AuJcx9qUP rHwq9Vgb3bR+FoONSuvNgM+Yx2GGLz/jCGOPfXh4= To: libcamera-devel@lists.libcamera.org, David Plowman , Kieran Bingham , Laurent Pinchart , Jacopo Mondi Date: Mon, 16 May 2022 17:10:10 +0300 Message-Id: <20220516141022.96327-3-tomi.valkeinen@ideasonboard.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220516141022.96327-1-tomi.valkeinen@ideasonboard.com> References: <20220516141022.96327-1-tomi.valkeinen@ideasonboard.com> MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH 02/14] 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 --- 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..fbd33139 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