[{"id":22962,"web_url":"https://patchwork.libcamera.org/comment/22962/","msgid":"<YoNZrV8d1L2wAgfG@pendragon.ideasonboard.com>","date":"2022-05-17T08:15:41","subject":"Re: [libcamera-devel] [PATCH 02/14] py: meson: add pystubs build\n\ttarget","submitter":{"id":2,"url":"https://patchwork.libcamera.org/api/people/2/","name":"Laurent Pinchart","email":"laurent.pinchart@ideasonboard.com"},"content":"Hi Tomi,\n\nThank you for the patch.\n\nOn Mon, May 16, 2022 at 05:10:10PM +0300, Tomi Valkeinen wrote:\n> Add a 'pystubs' build target for building the python stubs.\n> \n> For now this needs to be ran manually. I didn't figure out how to\n> generate the stubs after the libcamera bindings are built.\n\nWhat did you try ? custom_target() seems to be the right function for\nthis, did it fail ?\n\n> Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ideasonboard.com>\n> ---\n>  src/py/libcamera/meson.build | 14 +++++++++++++-\n>  1 file changed, 13 insertions(+), 1 deletion(-)\n> \n> diff --git a/src/py/libcamera/meson.build b/src/py/libcamera/meson.build\n> index 38f619d0..fbd33139 100644\n> --- a/src/py/libcamera/meson.build\n> +++ b/src/py/libcamera/meson.build\n> @@ -60,6 +60,18 @@ run_command('ln', '-fsT', '../../../../src/py/libcamera/__init__.py',\n>  \n>  install_data(['__init__.py'], install_dir : destdir)\n>  \n> -# \\todo Generate stubs when building. See https://peps.python.org/pep-0484/#stub-files\n> +# \\todo Generate stubs when building, and install them.\n> +# See https://peps.python.org/pep-0484/#stub-files\n>  # Note: Depends on pybind11-stubgen. To generate pylibcamera stubs:\n>  # $ PYTHONPATH=build/src/py pybind11-stubgen --no-setup-py -o build/src/py libcamera\n> +# The target below can be ran manually, but how to create a meson target that\n> +# is run if pycamera is built?\n> +\n> +stubgen = find_program('pybind11-stubgen', required : false)\n> +\n> +if stubgen.found()\n> +    run_target('pystubs',\n> +               depends: pycamera,\n> +               env: {'PYTHONPATH': meson.project_build_root() / 'src/py'},\n> +               command : [stubgen, '--no-setup-py', '-o', meson.project_build_root() / 'src/py', 'libcamera'])\n\nExtra space after ':'.\n\n'src/py' should be 'src' / 'py'.\n\n> +endif","headers":{"Return-Path":"<libcamera-devel-bounces@lists.libcamera.org>","X-Original-To":"parsemail@patchwork.libcamera.org","Delivered-To":"parsemail@patchwork.libcamera.org","Received":["from lancelot.ideasonboard.com (lancelot.ideasonboard.com\n\t[92.243.16.209])\n\tby patchwork.libcamera.org (Postfix) with ESMTPS id 1F9F4C3256\n\tfor <parsemail@patchwork.libcamera.org>;\n\tTue, 17 May 2022 08:15:51 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 6F20965656;\n\tTue, 17 May 2022 10:15:50 +0200 (CEST)","from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[213.167.242.64])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id EC89B60420\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tTue, 17 May 2022 10:15:48 +0200 (CEST)","from pendragon.ideasonboard.com (unknown [45.131.31.124])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id 1564648F;\n\tTue, 17 May 2022 10:15:48 +0200 (CEST)"],"DKIM-Signature":["v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org;\n\ts=mail; t=1652775350;\n\tbh=r6cqXvE9K/4vZRItCPn2qXSdZLICkOCBcRBNTR3EAdc=;\n\th=Date:To:References:In-Reply-To:Subject:List-Id:List-Unsubscribe:\n\tList-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:Cc:\n\tFrom;\n\tb=LHDuA2PXsiKAyCs2QZJgRSyxkbqjMZMiyseNW+PUBZuwnHYkkOaTEMzWWz/OkjAxO\n\tMv2O69lpZujS6yFh0ryDr6FXlZm/kSoLJMIi6Z455EkFf0gOB2m9En1GwBaosdzLPU\n\tidyFldytvqvbsUyXq0OmhNZuWXF3dwBNOFkwnjn9hSihEz5R4pF/REqqEUpq9YCj4h\n\tEiI9LHnlXfg4LlMBU7lDOEnh7Zq0jZzV0xiA0irnozGn46MRDMYIIc0lS5uWMmSdlR\n\taaV7ZIKteSehbmnN7mX9p0vVOtTAJmUEZDf36KGiUHYlpsiJytV0FQVhTkwl9Yd2rg\n\tHsWSf3Kd3DhAQ==","v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1652775348;\n\tbh=r6cqXvE9K/4vZRItCPn2qXSdZLICkOCBcRBNTR3EAdc=;\n\th=Date:From:To:Cc:Subject:References:In-Reply-To:From;\n\tb=lhRt5V/c0mNU5rPvFGu5NeMiPGxmWLWjpnTGFA65Kn8WWGGItCLpgx1yJ+SN032vU\n\tCIyGRQ0iN7gqNSIpzKdSNX7Me75N0sqnZtJE83JuxwlQmeBHiE67bsLKw+eFaTmTyS\n\tVq/0h1qbDfVFqUwV9ODKiZ5vBIMhIb4wYSxqzOZI="],"Authentication-Results":"lancelot.ideasonboard.com; dkim=pass (1024-bit key; \n\tunprotected) header.d=ideasonboard.com\n\theader.i=@ideasonboard.com\n\theader.b=\"lhRt5V/c\"; dkim-atps=neutral","Date":"Tue, 17 May 2022 11:15:41 +0300","To":"Tomi Valkeinen <tomi.valkeinen@ideasonboard.com>","Message-ID":"<YoNZrV8d1L2wAgfG@pendragon.ideasonboard.com>","References":"<20220516141022.96327-1-tomi.valkeinen@ideasonboard.com>\n\t<20220516141022.96327-3-tomi.valkeinen@ideasonboard.com>","MIME-Version":"1.0","Content-Type":"text/plain; charset=utf-8","Content-Disposition":"inline","In-Reply-To":"<20220516141022.96327-3-tomi.valkeinen@ideasonboard.com>","Subject":"Re: [libcamera-devel] [PATCH 02/14] py: meson: add pystubs build\n\ttarget","X-BeenThere":"libcamera-devel@lists.libcamera.org","X-Mailman-Version":"2.1.29","Precedence":"list","List-Id":"<libcamera-devel.lists.libcamera.org>","List-Unsubscribe":"<https://lists.libcamera.org/options/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=unsubscribe>","List-Archive":"<https://lists.libcamera.org/pipermail/libcamera-devel/>","List-Post":"<mailto:libcamera-devel@lists.libcamera.org>","List-Help":"<mailto:libcamera-devel-request@lists.libcamera.org?subject=help>","List-Subscribe":"<https://lists.libcamera.org/listinfo/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=subscribe>","From":"Laurent Pinchart via libcamera-devel\n\t<libcamera-devel@lists.libcamera.org>","Reply-To":"Laurent Pinchart <laurent.pinchart@ideasonboard.com>","Cc":"libcamera-devel@lists.libcamera.org","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"}},{"id":22966,"web_url":"https://patchwork.libcamera.org/comment/22966/","msgid":"<0c439233-5c17-ddfe-3c26-9d5a188fdd7d@ideasonboard.com>","date":"2022-05-17T08:19:32","subject":"Re: [libcamera-devel] [PATCH 02/14] py: meson: add pystubs build\n\ttarget","submitter":{"id":109,"url":"https://patchwork.libcamera.org/api/people/109/","name":"Tomi Valkeinen","email":"tomi.valkeinen@ideasonboard.com"},"content":"On 17/05/2022 11:15, Laurent Pinchart wrote:\n> Hi Tomi,\n> \n> Thank you for the patch.\n> \n> On Mon, May 16, 2022 at 05:10:10PM +0300, Tomi Valkeinen wrote:\n>> Add a 'pystubs' build target for building the python stubs.\n>>\n>> For now this needs to be ran manually. I didn't figure out how to\n>> generate the stubs after the libcamera bindings are built.\n> \n> What did you try ? custom_target() seems to be the right function for\n> this, did it fail ?\n\ncustom_target() needs a list of output files, which is not obvious here, \nand it also expects the outputs to be in the build dir of this source \ndirectory, which is also not the case.\n\n  Tomi","headers":{"Return-Path":"<libcamera-devel-bounces@lists.libcamera.org>","X-Original-To":"parsemail@patchwork.libcamera.org","Delivered-To":"parsemail@patchwork.libcamera.org","Received":["from lancelot.ideasonboard.com (lancelot.ideasonboard.com\n\t[92.243.16.209])\n\tby patchwork.libcamera.org (Postfix) with ESMTPS id 72DDBC3256\n\tfor <parsemail@patchwork.libcamera.org>;\n\tTue, 17 May 2022 08:19:37 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 2DC9860420;\n\tTue, 17 May 2022 10:19:37 +0200 (CEST)","from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[IPv6:2001:4b98:dc2:55:216:3eff:fef7:d647])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 45E7B60420\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tTue, 17 May 2022 10:19:36 +0200 (CEST)","from [192.168.1.111] (91-156-85-209.elisa-laajakaista.fi\n\t[91.156.85.209])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id CC85748F;\n\tTue, 17 May 2022 10:19:35 +0200 (CEST)"],"DKIM-Signature":["v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org;\n\ts=mail; t=1652775577;\n\tbh=l7E6mJRaNcP0S+eBsxEIaKM1DEbo1RyBFSNzyoXfrYY=;\n\th=Date:To:References:In-Reply-To:Subject:List-Id:List-Unsubscribe:\n\tList-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:Cc:\n\tFrom;\n\tb=colye8NGUWCKCEV5t5cshWF+/zDE5ZJ2lT53xWa+i/c08T8CFyvxmH5xZrpZ2+r/s\n\tofExTxsQ+Tfa8gjfpB+vaYx1fU8UR2YOHeGPl0RKXsIdepYGlV/qLTZ9mXyWyO87I0\n\tU8VfDOo0268XZmhffv1oTu7w3nU8877AJWm01s2aYgKKtzdT89M8WOrojMBoDMgeZx\n\tZmUfELbPRxM0ux6LAteVSiYWpsgvdspOKEoWTZhvfhVfY//fnubDm4PXwCcu+Z3yjm\n\t9H5Eq0YI+jrkf2DOVtOcJCVKv8vqiMBbL9+IM0fOJQBlgiJb4dxL0XTnjBCZsMbnta\n\tqzErbl5QdH6tA==","v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1652775576;\n\tbh=l7E6mJRaNcP0S+eBsxEIaKM1DEbo1RyBFSNzyoXfrYY=;\n\th=Date:Subject:To:Cc:References:From:In-Reply-To:From;\n\tb=XV63GvwWN/7xBTCMQibtmvQQuhzznMFrdR4x25HAyVw6OqFxeBoBRxvmkUnuzQCsg\n\tIJxQ3VGyySExMAALWdpHedwrhlZnSQ/0w6IQn8k5ptRFxr21vMeMcdAh2Hlin6P6Kj\n\tU6cl+VUvI2v3ddwJYamC7gatf9OBX4r4NxON1U3I="],"Authentication-Results":"lancelot.ideasonboard.com; dkim=pass (1024-bit key; \n\tunprotected) header.d=ideasonboard.com\n\theader.i=@ideasonboard.com\n\theader.b=\"XV63GvwW\"; dkim-atps=neutral","Message-ID":"<0c439233-5c17-ddfe-3c26-9d5a188fdd7d@ideasonboard.com>","Date":"Tue, 17 May 2022 11:19:32 +0300","MIME-Version":"1.0","User-Agent":"Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101\n\tThunderbird/91.8.0","Content-Language":"en-US","To":"Laurent Pinchart <laurent.pinchart@ideasonboard.com>","References":"<20220516141022.96327-1-tomi.valkeinen@ideasonboard.com>\n\t<20220516141022.96327-3-tomi.valkeinen@ideasonboard.com>\n\t<YoNZrV8d1L2wAgfG@pendragon.ideasonboard.com>","In-Reply-To":"<YoNZrV8d1L2wAgfG@pendragon.ideasonboard.com>","Content-Type":"text/plain; charset=UTF-8; format=flowed","Content-Transfer-Encoding":"7bit","Subject":"Re: [libcamera-devel] [PATCH 02/14] py: meson: add pystubs build\n\ttarget","X-BeenThere":"libcamera-devel@lists.libcamera.org","X-Mailman-Version":"2.1.29","Precedence":"list","List-Id":"<libcamera-devel.lists.libcamera.org>","List-Unsubscribe":"<https://lists.libcamera.org/options/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=unsubscribe>","List-Archive":"<https://lists.libcamera.org/pipermail/libcamera-devel/>","List-Post":"<mailto:libcamera-devel@lists.libcamera.org>","List-Help":"<mailto:libcamera-devel-request@lists.libcamera.org?subject=help>","List-Subscribe":"<https://lists.libcamera.org/listinfo/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=subscribe>","From":"Tomi Valkeinen via libcamera-devel\n\t<libcamera-devel@lists.libcamera.org>","Reply-To":"Tomi Valkeinen <tomi.valkeinen@ideasonboard.com>","Cc":"libcamera-devel@lists.libcamera.org","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"}}]