[{"id":28046,"web_url":"https://patchwork.libcamera.org/comment/28046/","msgid":"<20231025110402.GE481@pendragon.ideasonboard.com>","date":"2023-10-25T11:04:02","subject":"Re: [libcamera-devel] [PATCH] py: libcamera: Improve python binding\n\tinstallation","submitter":{"id":2,"url":"https://patchwork.libcamera.org/api/people/2/","name":"Laurent Pinchart","email":"laurent.pinchart@ideasonboard.com"},"content":"Hi William,\n\n(CC'ing Tomi)\n\nThank you for the patch.\n\nOn Wed, Oct 25, 2023 at 10:36:49AM +0100, William Vinnicombe via libcamera-devel wrote:\n> The existing meson.build file installs the bindings to an architecture\n> specific libdir (eg /usr/local/lib/aarch64-linux-gnu/), which is not\n> picked up by default python which only looks in the non architecture\n> specific libdir (eg /usr/local/lib/python3.11/). It also will always\n> build using the system python, rather than building using the same\n> python as meson is using. This prevents a user being able to build the\n> bindings for a different version of python, without changing their\n> system python to that version.\n> \n> Modify the build process to use the meson Python module to build the\n> python bindings targets, so it installs them to the correct directories\n> for python, and builds them for the version of python that meson is\n> running with.\n> \n> Signed-off-by: William Vinnicombe <william.vinnicombe@raspberrypi.com>\n> ---\n>  src/py/libcamera/meson.build | 23 ++++++++++++-----------\n>  1 file changed, 12 insertions(+), 11 deletions(-)\n> \n> diff --git a/src/py/libcamera/meson.build b/src/py/libcamera/meson.build\n> index f58c7198..e9e3f915 100644\n> --- a/src/py/libcamera/meson.build\n> +++ b/src/py/libcamera/meson.build\n> @@ -1,6 +1,8 @@\n>  # SPDX-License-Identifier: CC0-1.0\n>  \n> -py3_dep = dependency('python3', required : get_option('pycamera'))\n> +\n> +py = import('python').find_installation('python3', required : get_option('pycamera'))\n> +py3_dep = py.dependency(required : get_option('pycamera'))\n\nDoes this still work when cross-compiling ? I recall we tried the meson\npython module, and it had problems with cross-compilation. Tomi may know\nmore.\n\n>  \n>  if not py3_dep.found()\n>      pycamera_enabled = false\n> @@ -78,15 +80,12 @@ pycamera_args = [\n>      '-DPYBIND11_USE_SMART_HOLDER_AS_DEFAULT',\n>  ]\n>  \n> -destdir = get_option('libdir') / ('python' + py3_dep.version()) / 'site-packages' / 'libcamera'\n> -\n> -pycamera = shared_module('_libcamera',\n> -                         pycamera_sources,\n> -                         install : true,\n> -                         install_dir : destdir,\n> -                         name_prefix : '',\n> -                         dependencies : pycamera_deps,\n> -                         cpp_args : pycamera_args)\n> +pycamera = py.extension_module('_libcamera',\n> +                               pycamera_sources,\n> +                               install : true,\n> +                               subdir : 'libcamera',\n> +                               dependencies : pycamera_deps,\n> +                               cpp_args : pycamera_args)\n>  \n>  # Create symlinks from the build dir to the source dir so that we can use the\n>  # Python module directly from the build dir.\n> @@ -99,7 +98,9 @@ run_command('ln', '-fsrT', meson.current_source_dir() / 'utils',\n>              meson.current_build_dir() / 'utils',\n>              check : true)\n>  \n> -install_data(['__init__.py'], install_dir : destdir)\n> +py.install_sources(['__init__.py'],\n> +                   subdir : 'libcamera',\n> +                   pure : false)\n>  \n>  # \\todo Generate stubs when building. See https://peps.python.org/pep-0484/#stub-files\n>  # Note: Depends on pybind11-stubgen. To generate pylibcamera stubs:","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 AFA98C0DA4\n\tfor <parsemail@patchwork.libcamera.org>;\n\tWed, 25 Oct 2023 11:03:57 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 1AF746298F;\n\tWed, 25 Oct 2023 13:03:57 +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 F1F0960556\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tWed, 25 Oct 2023 13:03:55 +0200 (CEST)","from pendragon.ideasonboard.com (213-243-189-158.bb.dnainternet.fi\n\t[213.243.189.158])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id CE49DBD1;\n\tWed, 25 Oct 2023 13:03:43 +0200 (CEST)"],"DKIM-Signature":["v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org;\n\ts=mail; t=1698231837;\n\tbh=gehrfGx6kqTrcALg0FVRnG10i9Jcz1Hyfb9Xsfci2EU=;\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=2ekEG/WSpiXIWxQINWoxUGDpDt5js11Rw7FJQb1GCqw0om0RR2dasEQQcgGWdRdlZ\n\tIU/Xy8YB4C73KTmW0SyWNOIDD+67hjKuEaoiFE5NZ/IjuCAksNkFkT8qQdeF3iTDMS\n\tcJmgC5tenBm+rwV/S+gUw6GknAIeZBpfviW4JwjIuN0fwAp3gx9ExxzPB4JmQddVAD\n\t6h1y1RMyEjw4Jv3sY+lnG2xJkneGTGVNoOyBNo603q1DGPo3AK6WXL/ven10cUVEQ7\n\tj/bIsEMKIX24rXrEoEzjHEDzc1UdapMZF1fztFmEJ0VoMeujMLTqQw+PfelH9u/42j\n\tr10qtcErensjQ==","v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1698231824;\n\tbh=gehrfGx6kqTrcALg0FVRnG10i9Jcz1Hyfb9Xsfci2EU=;\n\th=Date:From:To:Cc:Subject:References:In-Reply-To:From;\n\tb=IQ5OjOUDCXpBaGpylKrs+5J60qJ3Bmc6Gkeb/MCvIIW6ohFyTyWBYZFKdJddT2QvH\n\tutnz0pjb/tGvXeoXdC9i6rp6RWWuKdV2kiuPhUKBvylWyz0zpBYVeJ4UVRPhVzG55d\n\t8OWti0IlFG9XtnyZxjM/9Av5XGLpd8wUsnmun+u8="],"Authentication-Results":"lancelot.ideasonboard.com; dkim=pass (1024-bit key; \n\tunprotected) header.d=ideasonboard.com\n\theader.i=@ideasonboard.com\n\theader.b=\"IQ5OjOUD\"; dkim-atps=neutral","Date":"Wed, 25 Oct 2023 14:04:02 +0300","To":"William Vinnicombe <william.vinnicombe@raspberrypi.com>","Message-ID":"<20231025110402.GE481@pendragon.ideasonboard.com>","References":"<20231025093649.25222-1-william.vinnicombe@raspberrypi.com>","MIME-Version":"1.0","Content-Type":"text/plain; charset=utf-8","Content-Disposition":"inline","In-Reply-To":"<20231025093649.25222-1-william.vinnicombe@raspberrypi.com>","Subject":"Re: [libcamera-devel] [PATCH] py: libcamera: Improve python binding\n\tinstallation","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":28047,"web_url":"https://patchwork.libcamera.org/comment/28047/","msgid":"<2a6b589d-29fb-443e-9ab8-4516bad04d71@ideasonboard.com>","date":"2023-10-26T05:39:25","subject":"Re: [libcamera-devel] [PATCH] py: libcamera: Improve python binding\n\tinstallation","submitter":{"id":109,"url":"https://patchwork.libcamera.org/api/people/109/","name":"Tomi Valkeinen","email":"tomi.valkeinen@ideasonboard.com"},"content":"On 25/10/2023 14:04, Laurent Pinchart wrote:\n> Hi William,\n> \n> (CC'ing Tomi)\n> \n> Thank you for the patch.\n> \n> On Wed, Oct 25, 2023 at 10:36:49AM +0100, William Vinnicombe via libcamera-devel wrote:\n>> The existing meson.build file installs the bindings to an architecture\n>> specific libdir (eg /usr/local/lib/aarch64-linux-gnu/), which is not\n>> picked up by default python which only looks in the non architecture\n>> specific libdir (eg /usr/local/lib/python3.11/). It also will always\n>> build using the system python, rather than building using the same\n>> python as meson is using. This prevents a user being able to build the\n>> bindings for a different version of python, without changing their\n>> system python to that version.\n>>\n>> Modify the build process to use the meson Python module to build the\n>> python bindings targets, so it installs them to the correct directories\n>> for python, and builds them for the version of python that meson is\n>> running with.\n>>\n>> Signed-off-by: William Vinnicombe <william.vinnicombe@raspberrypi.com>\n>> ---\n>>   src/py/libcamera/meson.build | 23 ++++++++++++-----------\n>>   1 file changed, 12 insertions(+), 11 deletions(-)\n>>\n>> diff --git a/src/py/libcamera/meson.build b/src/py/libcamera/meson.build\n>> index f58c7198..e9e3f915 100644\n>> --- a/src/py/libcamera/meson.build\n>> +++ b/src/py/libcamera/meson.build\n>> @@ -1,6 +1,8 @@\n>>   # SPDX-License-Identifier: CC0-1.0\n>>   \n>> -py3_dep = dependency('python3', required : get_option('pycamera'))\n>> +\n>> +py = import('python').find_installation('python3', required : get_option('pycamera'))\n>> +py3_dep = py.dependency(required : get_option('pycamera'))\n> \n> Does this still work when cross-compiling ? I recall we tried the meson\n> python module, and it had problems with cross-compilation. Tomi may know\n> more.\n\nRight. When cross-compiling, you don't want that \"[the build process] \nbuilds them for the version of python that meson is running with\", as \nmeson is running (for me) in x86 environment, but the target is arm.\n\nI'm not sure if there's been any work on fixing all that in the meson \nside, but the last time I talked to them they didn't have any clear \nideas how to fix it.\n\nPerhaps this can be solved by manually dealing with all the python \ndetails in the meson.build file, and adding a meson option so that the \nuser can tell which python to use.\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 E28A5BDCBD\n\tfor <parsemail@patchwork.libcamera.org>;\n\tThu, 26 Oct 2023 05:39:30 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 4F8AA6298F;\n\tThu, 26 Oct 2023 07:39:30 +0200 (CEST)","from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[213.167.242.64])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id BBA9461DC7\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tThu, 26 Oct 2023 07:39:28 +0200 (CEST)","from [192.168.88.20] (91-158-149-209.elisa-laajakaista.fi\n\t[91.158.149.209])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id CC2DD75B;\n\tThu, 26 Oct 2023 07:39:15 +0200 (CEST)"],"DKIM-Signature":["v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org;\n\ts=mail; t=1698298770;\n\tbh=ecOjL2zUNckTtRWGGSpzSxaRVdxYW65SXXR4zUGx0vI=;\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=oumz1pn8+URAYQAJSQhjyc9L05MirWTKBgreYj4f19Nw8eu4/3RMoF+PXKw1pibCj\n\tZgkQKL+3RiMd4FT8HaappIWVN9xYRWEzMdiJF76BM1swxyfVz/6Vjh+RtJzAn7Ennk\n\t/fWDDWyiU7897hmDzB5i9S1IAfBozeH2Sj+uJni2I9IctAaYZ7A2iR9fGCU11TLjrO\n\tIcBMX9nU3LJQbPhQOeRiV3DFJQkq/gMD/H9OLF6xHU900rY1cqGOH7ap5G85B7fbSJ\n\thv0zY6m5KO5V9q6jrPY6BQzzlUo6CPj/IBVSbw90+2uFWWisgqwyVzIvMsbhr2eoxG\n\tWxb7/ls1JccnQ==","v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1698298756;\n\tbh=ecOjL2zUNckTtRWGGSpzSxaRVdxYW65SXXR4zUGx0vI=;\n\th=Date:Subject:To:Cc:References:From:In-Reply-To:From;\n\tb=Ek+bqK5yHtMIkF9aTqJoQ9eRMuS8z/bunIzvKqChdju+9+xXLuQea5+KN9ENH6u57\n\tzyMXbLp4fTCNWQr7TA2ljSSN4Fh37F4OkW2skLo0sTTlP/0rqudEvcTdcFCGY7mj2U\n\tdULSA/Dhs27RNjRHStYaY0TdLbW+YHSiUR16elDM="],"Authentication-Results":"lancelot.ideasonboard.com; dkim=pass (1024-bit key; \n\tunprotected) header.d=ideasonboard.com\n\theader.i=@ideasonboard.com\n\theader.b=\"Ek+bqK5y\"; dkim-atps=neutral","Message-ID":"<2a6b589d-29fb-443e-9ab8-4516bad04d71@ideasonboard.com>","Date":"Thu, 26 Oct 2023 08:39:25 +0300","MIME-Version":"1.0","User-Agent":"Mozilla Thunderbird","Content-Language":"en-US","To":"Laurent Pinchart <laurent.pinchart@ideasonboard.com>,\n\tWilliam Vinnicombe <william.vinnicombe@raspberrypi.com>","References":"<20231025093649.25222-1-william.vinnicombe@raspberrypi.com>\n\t<20231025110402.GE481@pendragon.ideasonboard.com>","Autocrypt":"addr=tomi.valkeinen@ideasonboard.com; keydata=\n\txsFNBE6ms0cBEACyizowecZqXfMZtnBniOieTuFdErHAUyxVgtmr0f5ZfIi9Z4l+uUN4Zdw2\n\twCEZjx3o0Z34diXBaMRJ3rAk9yB90UJAnLtb8A97Oq64DskLF81GCYB2P1i0qrG7UjpASgCA\n\tRu0lVvxsWyIwSfoYoLrazbT1wkWRs8YBkkXQFfL7Mn3ZMoGPcpfwYH9O7bV1NslbmyJzRCMO\n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EQEAAcLBXwQYAQIACQUCTqazRwIbDAAKCRD6PaqMvJYe\n\t9fA7EACS6exUedsBKmt4pT7nqXBcRsqm6YzT6DeCM8PWMTeaVGHiR4TnNFiT3otD5UpYQI7S\n\tsuYxoTdHrrrBzdlKe5rUWpzoZkVK6p0s9OIvGzLT0lrb0HC9iNDWT3JgpYDnk4Z2mFi6tTbq\n\txKMtpVFRA6FjviGDRsfkfoURZI51nf2RSAk/A8BEDDZ7lgJHskYoklSpwyrXhkp9FHGMaYII\n\tm9EKuUTX9JPDG2FTthCBrdsgWYPdJQvM+zscq09vFMQ9Fykbx5N8z/oFEUy3ACyPqW2oyfvU\n\tCH5WDpWBG0s5BALp1gBJPytIAd/pY/5ZdNoi0Cx3+Z7jaBFEyYJdWy1hGddpkgnMjyOfLI7B\n\tCFrdecTZbR5upjNSDvQ7RG85SnpYJTIin+SAUazAeA2nS6gTZzumgtdw8XmVXZwdBfF+ICof\n\t92UkbYcYNbzWO/GHgsNT1WnM4sa9lwCSWH8Fw1o/3bX1VVPEsnESOfxkNdu+gAF5S6+I6n3a\n\tueeIlwJl5CpT5l8RpoZXEOVtXYn8zzOJ7oGZYINRV9Pf8qKGLf3Dft7zKBP832I3PQjeok7F\n\tyjt+9S+KgSFSHP3Pa4E7lsSdWhSlHYNdG/czhoUkSCN09C0rEK93wxACx3vtxPLjXu6RptBw\n\t3dRq7n+mQChEB1am0BueV1JZaBboIL0AGlSJkm23kw==","In-Reply-To":"<20231025110402.GE481@pendragon.ideasonboard.com>","Content-Type":"text/plain; charset=UTF-8; format=flowed","Content-Transfer-Encoding":"7bit","Subject":"Re: [libcamera-devel] [PATCH] py: libcamera: Improve python binding\n\tinstallation","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>"}},{"id":28048,"web_url":"https://patchwork.libcamera.org/comment/28048/","msgid":"<CAA9M1nX=_w7VMWzqyBneEzz-ER0rOBcitAu5xkDAXKRUEpgaKQ@mail.gmail.com>","date":"2023-10-26T10:15:48","subject":"Re: [libcamera-devel] [PATCH] py: libcamera: Improve python binding\n\tinstallation","submitter":{"id":131,"url":"https://patchwork.libcamera.org/api/people/131/","name":"William Vinnicombe","email":"william.vinnicombe@raspberrypi.com"},"content":"Hi both,\n\nThanks for your comments - I hadn't considered cross compilation, but from\nlooking into it I can see that this change would cause the problems you've\nmentioned. Would it be an acceptable solution to wrap these changes within\n\"if meson.is_cross_build() else ...\" so that cross compilation uses the\nprevious code still, but native compilation uses the meson python module?\nIf so, I'll submit a v2 with those changes.\n\nThanks,\n\nWilliam\n\nOn Thu, 26 Oct 2023 at 06:39, Tomi Valkeinen <\ntomi.valkeinen@ideasonboard.com> wrote:\n\n> On 25/10/2023 14:04, Laurent Pinchart wrote:\n> > Hi William,\n> >\n> > (CC'ing Tomi)\n> >\n> > Thank you for the patch.\n> >\n> > On Wed, Oct 25, 2023 at 10:36:49AM +0100, William Vinnicombe via\n> libcamera-devel wrote:\n> >> The existing meson.build file installs the bindings to an architecture\n> >> specific libdir (eg /usr/local/lib/aarch64-linux-gnu/), which is not\n> >> picked up by default python which only looks in the non architecture\n> >> specific libdir (eg /usr/local/lib/python3.11/). It also will always\n> >> build using the system python, rather than building using the same\n> >> python as meson is using. This prevents a user being able to build the\n> >> bindings for a different version of python, without changing their\n> >> system python to that version.\n> >>\n> >> Modify the build process to use the meson Python module to build the\n> >> python bindings targets, so it installs them to the correct directories\n> >> for python, and builds them for the version of python that meson is\n> >> running with.\n> >>\n> >> Signed-off-by: William Vinnicombe <william.vinnicombe@raspberrypi.com>\n> >> ---\n> >>   src/py/libcamera/meson.build | 23 ++++++++++++-----------\n> >>   1 file changed, 12 insertions(+), 11 deletions(-)\n> >>\n> >> diff --git a/src/py/libcamera/meson.build b/src/py/libcamera/meson.build\n> >> index f58c7198..e9e3f915 100644\n> >> --- a/src/py/libcamera/meson.build\n> >> +++ b/src/py/libcamera/meson.build\n> >> @@ -1,6 +1,8 @@\n> >>   # SPDX-License-Identifier: CC0-1.0\n> >>\n> >> -py3_dep = dependency('python3', required : get_option('pycamera'))\n> >> +\n> >> +py = import('python').find_installation('python3', required :\n> get_option('pycamera'))\n> >> +py3_dep = py.dependency(required : get_option('pycamera'))\n> >\n> > Does this still work when cross-compiling ? I recall we tried the meson\n> > python module, and it had problems with cross-compilation. Tomi may know\n> > more.\n>\n> Right. When cross-compiling, you don't want that \"[the build process]\n> builds them for the version of python that meson is running with\", as\n> meson is running (for me) in x86 environment, but the target is arm.\n>\n> I'm not sure if there's been any work on fixing all that in the meson\n> side, but the last time I talked to them they didn't have any clear\n> ideas how to fix it.\n>\n> Perhaps this can be solved by manually dealing with all the python\n> details in the meson.build file, and adding a meson option so that the\n> user can tell which python to use.\n>\n>   Tomi\n>\n>","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 44330C0DA4\n\tfor <parsemail@patchwork.libcamera.org>;\n\tThu, 26 Oct 2023 10:16:02 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id BDBE36298F;\n\tThu, 26 Oct 2023 12:16:01 +0200 (CEST)","from mail-pg1-x52f.google.com (mail-pg1-x52f.google.com\n\t[IPv6:2607:f8b0:4864:20::52f])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id E66B661DCC\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tThu, 26 Oct 2023 12:15:59 +0200 (CEST)","by mail-pg1-x52f.google.com with SMTP id\n\t41be03b00d2f7-5a9bc2ec556so617558a12.0\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tThu, 26 Oct 2023 03:15:59 -0700 (PDT)"],"DKIM-Signature":["v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org;\n\ts=mail; t=1698315361;\n\tbh=D79D01KNXgqsND1SAdbJyXdSh3Qx8O7QvboGSI6MKFM=;\n\th=References:In-Reply-To:Date:To:Subject:List-Id:List-Unsubscribe:\n\tList-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:Cc:\n\tFrom;\n\tb=wfVciSJQbWAFMTc8sDup0aZT2EAj/WljczmEFUlvT/o6VRvoYYH1LsAizVLWgFRID\n\t7mEwThZA0Z1b4HhYEkTufZ/NTDJcwqcO5OkqUKzZCt56NLy2UObpzyKOxyXwVTCriT\n\t2USukoshI2UkA5PDvQq19VcJ61TPrjNE2DPPNe0BkYT7b8tUvobdVAR9SmvDtQj81s\n\tUwt8BS8N1HDle/XwRCltHW1fyEgXWQJ8WR3CXP8WmlyX8043bU5q0cbzCQA/Sm8v6z\n\t+c9gVJw/JFRdHSRT02Y+3jWTmjvbT+6Ce7D6dixtHJiddEPzhnCDHFkOkMRCeQX5kv\n\t4ly6+N7I1YoRQ==","v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=raspberrypi.com; s=google; t=1698315358; x=1698920158;\n\tdarn=lists.libcamera.org; \n\th=cc:to:subject:message-id:date:from:in-reply-to:references\n\t:mime-version:from:to:cc:subject:date:message-id:reply-to;\n\tbh=i7EREMOV4kkleHCvqEnA7gLlEr1m+iRcEJn0R/mYv4E=;\n\tb=aarbGTDMfoW8GFPGJAV7vvKle9WDslCzTe4wJPMhNECzUsfbO63hgY2ndjVkFn4uUO\n\t6eFSqINhMh0TZxjLQXjaCL+fWeZ1RYtVYMTwrgL1XYHDva+CTrgPcxaeQi7mRRs3hC0Y\n\tX3WLEbLGfFdD7zRmllGOa6z7QI6EzsZOcgkAqVrNa4bbTGZhNyDuHoTpZ9qbfQqfJAHF\n\tA6VO3ahqF0dOj5SDdeVkaoc8voSqyRhCl6hn5gGnpAyaO2ZyNwHlR6ubgAcLnanVBw3W\n\tzgOQZ8wN6H6/zQV4LmK5UVSV6CB2sBlFp8DMgf9TH4nwxfrFxCa/AZHQZn0p49Mg87Ol\n\tFxEA=="],"Authentication-Results":"lancelot.ideasonboard.com; dkim=pass (2048-bit key; \n\tunprotected) header.d=raspberrypi.com\n\theader.i=@raspberrypi.com\n\theader.b=\"aarbGTDM\"; dkim-atps=neutral","X-Google-DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=1e100.net; s=20230601; t=1698315358; x=1698920158;\n\th=cc:to:subject:message-id:date:from:in-reply-to:references\n\t:mime-version:x-gm-message-state:from:to:cc:subject:date:message-id\n\t:reply-to;\n\tbh=i7EREMOV4kkleHCvqEnA7gLlEr1m+iRcEJn0R/mYv4E=;\n\tb=Q9t9gzcyvX45Wk7BJ6AaoEmGhP0tCVaqpO2Ay/CLaTjsL+gaH0LzCnmjU/0lCIgDvd\n\tRPwWuRm0DGA46YrET1oZ18kOk6SWNVXv/veK22vlSz/q6LvjbHK68qTr+j32Z76Nqr+3\n\tmWjNMvtjyIEle+9D9EklF0FEU28EtjrNj4RaCF5ZAWR86PRcwXWSAT76C8cSMpbLiyhM\n\tXqSISAnIsI/qzqsR1TQZ0z9axHxPGzwbtR/iiIkeXYM3ShOFwGYWhE49AxtleaQjw6Qa\n\tdm7RceCofUU0jg9/HpcuZZQ0WEBIff1dUiDYi7hAdNzRGTHHKpCS5AmyuKXn/QXywSJM\n\tZv8Q==","X-Gm-Message-State":"AOJu0YzVbllCmuH+LD9oGNMH1ccDkGinEyXQsLSj+nSIEXVqmRKDhLap\n\tUaB4Q8CHhyrCWqxCzV84/CNPnYXt3RzNEiuHwGKcWA==","X-Google-Smtp-Source":"AGHT+IHH+qM38BdpjOkc7zNa9ltW/I3Jkf6SbhgH/UVPIIyDryMgdvaDUvSnuAFaStxLsaw284z38LEa6lHM2DVckns=","X-Received":"by 2002:a17:90a:356:b0:27d:e29:8352 with SMTP id\n\t22-20020a17090a035600b0027d0e298352mr14733954pjf.45.1698315358136;\n\tThu, 26 Oct 2023 03:15:58 -0700 (PDT)","MIME-Version":"1.0","References":"<20231025093649.25222-1-william.vinnicombe@raspberrypi.com>\n\t<20231025110402.GE481@pendragon.ideasonboard.com>\n\t<2a6b589d-29fb-443e-9ab8-4516bad04d71@ideasonboard.com>","In-Reply-To":"<2a6b589d-29fb-443e-9ab8-4516bad04d71@ideasonboard.com>","Date":"Thu, 26 Oct 2023 11:15:48 +0100","Message-ID":"<CAA9M1nX=_w7VMWzqyBneEzz-ER0rOBcitAu5xkDAXKRUEpgaKQ@mail.gmail.com>","To":"Tomi Valkeinen <tomi.valkeinen@ideasonboard.com>","Content-Type":"multipart/alternative; boundary=\"000000000000a3881e06089bdbf2\"","Subject":"Re: [libcamera-devel] [PATCH] py: libcamera: Improve python binding\n\tinstallation","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":"William Vinnicombe via libcamera-devel\n\t<libcamera-devel@lists.libcamera.org>","Reply-To":"William Vinnicombe <william.vinnicombe@raspberrypi.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":28049,"web_url":"https://patchwork.libcamera.org/comment/28049/","msgid":"<5e53f391-2508-402a-8f82-6f413362dd5e@ideasonboard.com>","date":"2023-10-26T10:18:14","subject":"Re: [libcamera-devel] [PATCH] py: libcamera: Improve python binding\n\tinstallation","submitter":{"id":109,"url":"https://patchwork.libcamera.org/api/people/109/","name":"Tomi Valkeinen","email":"tomi.valkeinen@ideasonboard.com"},"content":"On 26/10/2023 13:15, William Vinnicombe wrote:\n> Hi both,\n> \n> Thanks for your comments - I hadn't considered cross compilation, but \n> from looking into it I can see that this change would cause the problems \n> you've mentioned. Would it be an acceptable solution to wrap these \n> changes within \"if meson.is_cross_build() else ...\" so that cross \n> compilation uses the previous code still, but native compilation uses \n> the meson python module? If so, I'll submit a v2 with those changes.\n\nI don't see why not, presuming it works =). Do you have a \ncross-compilation environment (e.g. buildroot) for testing?\n\n  Tomi\n\n> \n> Thanks,\n> \n> William\n> \n> On Thu, 26 Oct 2023 at 06:39, Tomi Valkeinen \n> <tomi.valkeinen@ideasonboard.com \n> <mailto:tomi.valkeinen@ideasonboard.com>> wrote:\n> \n>     On 25/10/2023 14:04, Laurent Pinchart wrote:\n>      > Hi William,\n>      >\n>      > (CC'ing Tomi)\n>      >\n>      > Thank you for the patch.\n>      >\n>      > On Wed, Oct 25, 2023 at 10:36:49AM +0100, William Vinnicombe via\n>     libcamera-devel wrote:\n>      >> The existing meson.build file installs the bindings to an\n>     architecture\n>      >> specific libdir (eg /usr/local/lib/aarch64-linux-gnu/), which is not\n>      >> picked up by default python which only looks in the non architecture\n>      >> specific libdir (eg /usr/local/lib/python3.11/). It also will always\n>      >> build using the system python, rather than building using the same\n>      >> python as meson is using. This prevents a user being able to\n>     build the\n>      >> bindings for a different version of python, without changing their\n>      >> system python to that version.\n>      >>\n>      >> Modify the build process to use the meson Python module to build the\n>      >> python bindings targets, so it installs them to the correct\n>     directories\n>      >> for python, and builds them for the version of python that meson is\n>      >> running with.\n>      >>\n>      >> Signed-off-by: William Vinnicombe\n>     <william.vinnicombe@raspberrypi.com\n>     <mailto:william.vinnicombe@raspberrypi.com>>\n>      >> ---\n>      >>   src/py/libcamera/meson.build | 23 ++++++++++++-----------\n>      >>   1 file changed, 12 insertions(+), 11 deletions(-)\n>      >>\n>      >> diff --git a/src/py/libcamera/meson.build\n>     b/src/py/libcamera/meson.build\n>      >> index f58c7198..e9e3f915 100644\n>      >> --- a/src/py/libcamera/meson.build\n>      >> +++ b/src/py/libcamera/meson.build\n>      >> @@ -1,6 +1,8 @@\n>      >>   # SPDX-License-Identifier: CC0-1.0\n>      >>\n>      >> -py3_dep = dependency('python3', required : get_option('pycamera'))\n>      >> +\n>      >> +py = import('python').find_installation('python3', required :\n>     get_option('pycamera'))\n>      >> +py3_dep = py.dependency(required : get_option('pycamera'))\n>      >\n>      > Does this still work when cross-compiling ? I recall we tried the\n>     meson\n>      > python module, and it had problems with cross-compilation. Tomi\n>     may know\n>      > more.\n> \n>     Right. When cross-compiling, you don't want that \"[the build process]\n>     builds them for the version of python that meson is running with\", as\n>     meson is running (for me) in x86 environment, but the target is arm.\n> \n>     I'm not sure if there's been any work on fixing all that in the meson\n>     side, but the last time I talked to them they didn't have any clear\n>     ideas how to fix it.\n> \n>     Perhaps this can be solved by manually dealing with all the python\n>     details in the meson.build file, and adding a meson option so that the\n>     user can tell which python to use.\n> \n>        Tomi\n>","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 70D23C0DA4\n\tfor <parsemail@patchwork.libcamera.org>;\n\tThu, 26 Oct 2023 10:18:20 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id C145B6298F;\n\tThu, 26 Oct 2023 12:18:19 +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 227A661DCC\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tThu, 26 Oct 2023 12:18:18 +0200 (CEST)","from [192.168.88.20] (91-158-149-209.elisa-laajakaista.fi\n\t[91.158.149.209])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id 359C775B;\n\tThu, 26 Oct 2023 12:18:05 +0200 (CEST)"],"DKIM-Signature":["v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org;\n\ts=mail; t=1698315499;\n\tbh=zeyIK03unSFq5mxzDdTttMFQwnUZC6y7O/04/3u9QmE=;\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=2u4w6xXNYgxPUZ3dKcINVy7FELObz+0aEeTQOJy90lUIcgH5B+marEB8kSeaP3C/U\n\trIF1jwrRZsdBnzAJZWW09MsK9pE0/1qK1IOm8XHasSTXNpOkJbDy2pzrYDnvnJHdsI\n\th9DwTgM5guWMdz61VBEwzDLrFwH0Ydmpaj15UCJtBYCxckMHo3lALVi3dWLywBxqyR\n\tXAQze622QNmsYNjiYlQrldqjVw2gZflJOs/nK8+WqNM9H3L/gNjssRFRJ2jEzTI51g\n\tBaVhyY1MBrickTNcS+4m1GQtX1QMYwtsnod/N8wKfNlDrmxQ+dLkuc+hKFg1bKhVIO\n\tKXNKYjEDOQ1Iw==","v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1698315485;\n\tbh=zeyIK03unSFq5mxzDdTttMFQwnUZC6y7O/04/3u9QmE=;\n\th=Date:Subject:To:Cc:References:From:In-Reply-To:From;\n\tb=ABCwF7rXymegrdcdCnELe0nwVWOMf7gNIpFlagNQxxgGUNzAjTIyA15jopurOfMyG\n\tEmm7EMNlOQg9+c9DDHAsHVWR3ixbZbgsitwCFUDVeBZ3OHbkQftwtOovYrCDcmE9jJ\n\tqfbt+B10sIalapjT7CypHrp1+dx/8SZbbz0Zk4o4="],"Authentication-Results":"lancelot.ideasonboard.com; dkim=pass (1024-bit key; \n\tunprotected) header.d=ideasonboard.com\n\theader.i=@ideasonboard.com\n\theader.b=\"ABCwF7rX\"; dkim-atps=neutral","Message-ID":"<5e53f391-2508-402a-8f82-6f413362dd5e@ideasonboard.com>","Date":"Thu, 26 Oct 2023 13:18:14 +0300","MIME-Version":"1.0","User-Agent":"Mozilla Thunderbird","Content-Language":"en-US","To":"William Vinnicombe <william.vinnicombe@raspberrypi.com>","References":"<20231025093649.25222-1-william.vinnicombe@raspberrypi.com>\n\t<20231025110402.GE481@pendragon.ideasonboard.com>\n\t<2a6b589d-29fb-443e-9ab8-4516bad04d71@ideasonboard.com>\n\t<CAA9M1nX=_w7VMWzqyBneEzz-ER0rOBcitAu5xkDAXKRUEpgaKQ@mail.gmail.com>","Autocrypt":"addr=tomi.valkeinen@ideasonboard.com; keydata=\n\txsFNBE6ms0cBEACyizowecZqXfMZtnBniOieTuFdErHAUyxVgtmr0f5ZfIi9Z4l+uUN4Zdw2\n\twCEZjx3o0Z34diXBaMRJ3rAk9yB90UJAnLtb8A97Oq64DskLF81GCYB2P1i0qrG7UjpASgCA\n\tRu0lVvxsWyIwSfoYo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7QxWIfWtp+VnwNGc6nq5IQDESH\n\tmvQcsFS7d3eGVI6eyjCFdcAO8eMAEQEAAcLBXwQYAQIACQUCTqazRwIbDAAKCRD6PaqMvJYe\n\t9fA7EACS6exUedsBKmt4pT7nqXBcRsqm6YzT6DeCM8PWMTeaVGHiR4TnNFiT3otD5UpYQI7S\n\tsuYxoTdHrrrBzdlKe5rUWpzoZkVK6p0s9OIvGzLT0lrb0HC9iNDWT3JgpYDnk4Z2mFi6tTbq\n\txKMtpVFRA6FjviGDRsfkfoURZI51nf2RSAk/A8BEDDZ7lgJHskYoklSpwyrXhkp9FHGMaYII\n\tm9EKuUTX9JPDG2FTthCBrdsgWYPdJQvM+zscq09vFMQ9Fykbx5N8z/oFEUy3ACyPqW2oyfvU\n\tCH5WDpWBG0s5BALp1gBJPytIAd/pY/5ZdNoi0Cx3+Z7jaBFEyYJdWy1hGddpkgnMjyOfLI7B\n\tCFrdecTZbR5upjNSDvQ7RG85SnpYJTIin+SAUazAeA2nS6gTZzumgtdw8XmVXZwdBfF+ICof\n\t92UkbYcYNbzWO/GHgsNT1WnM4sa9lwCSWH8Fw1o/3bX1VVPEsnESOfxkNdu+gAF5S6+I6n3a\n\tueeIlwJl5CpT5l8RpoZXEOVtXYn8zzOJ7oGZYINRV9Pf8qKGLf3Dft7zKBP832I3PQjeok7F\n\tyjt+9S+KgSFSHP3Pa4E7lsSdWhSlHYNdG/czhoUkSCN09C0rEK93wxACx3vtxPLjXu6RptBw\n\t3dRq7n+mQChEB1am0BueV1JZaBboIL0AGlSJkm23kw==","In-Reply-To":"<CAA9M1nX=_w7VMWzqyBneEzz-ER0rOBcitAu5xkDAXKRUEpgaKQ@mail.gmail.com>","Content-Type":"text/plain; charset=UTF-8; format=flowed","Content-Transfer-Encoding":"8bit","Subject":"Re: [libcamera-devel] [PATCH] py: libcamera: Improve python binding\n\tinstallation","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>"}},{"id":28050,"web_url":"https://patchwork.libcamera.org/comment/28050/","msgid":"<CAA9M1nXM6C9hxR8fVOL6NstbVuK_pN6WsgTr0qxb9UGm+0t18w@mail.gmail.com>","date":"2023-10-26T12:33:27","subject":"Re: [libcamera-devel] [PATCH] py: libcamera: Improve python binding\n\tinstallation","submitter":{"id":131,"url":"https://patchwork.libcamera.org/api/people/131/","name":"William Vinnicombe","email":"william.vinnicombe@raspberrypi.com"},"content":"On Thu, 26 Oct 2023 at 11:18, Tomi Valkeinen <\ntomi.valkeinen@ideasonboard.com> wrote:\n\n> On 26/10/2023 13:15, William Vinnicombe wrote:\n> > Hi both,\n> >\n> > Thanks for your comments - I hadn't considered cross compilation, but\n> > from looking into it I can see that this change would cause the problems\n> > you've mentioned. Would it be an acceptable solution to wrap these\n> > changes within \"if meson.is_cross_build() else ...\" so that cross\n> > compilation uses the previous code still, but native compilation uses\n> > the meson python module? If so, I'll submit a v2 with those changes.\n>\n> I don't see why not, presuming it works =). Do you have a\n> cross-compilation environment (e.g. buildroot) for testing?\n>\n\nI have tested my v2 with buildroot and it seems to be working as expected,\nso I'll push that to the mailing list now. Although probably worth someone\nelse testing it too, as I don't have much experience with cross-compiling.\n\n\n>\n>   Tomi\n>\n> >\n> > Thanks,\n> >\n> > William\n> >\n> > On Thu, 26 Oct 2023 at 06:39, Tomi Valkeinen\n> > <tomi.valkeinen@ideasonboard.com\n> > <mailto:tomi.valkeinen@ideasonboard.com>> wrote:\n> >\n> >     On 25/10/2023 14:04, Laurent Pinchart wrote:\n> >      > Hi William,\n> >      >\n> >      > (CC'ing Tomi)\n> >      >\n> >      > Thank you for the patch.\n> >      >\n> >      > On Wed, Oct 25, 2023 at 10:36:49AM +0100, William Vinnicombe via\n> >     libcamera-devel wrote:\n> >      >> The existing meson.build file installs the bindings to an\n> >     architecture\n> >      >> specific libdir (eg /usr/local/lib/aarch64-linux-gnu/), which is\n> not\n> >      >> picked up by default python which only looks in the non\n> architecture\n> >      >> specific libdir (eg /usr/local/lib/python3.11/). It also will\n> always\n> >      >> build using the system python, rather than building using the\n> same\n> >      >> python as meson is using. This prevents a user being able to\n> >     build the\n> >      >> bindings for a different version of python, without changing\n> their\n> >      >> system python to that version.\n> >      >>\n> >      >> Modify the build process to use the meson Python module to build\n> the\n> >      >> python bindings targets, so it installs them to the correct\n> >     directories\n> >      >> for python, and builds them for the version of python that meson\n> is\n> >      >> running with.\n> >      >>\n> >      >> Signed-off-by: William Vinnicombe\n> >     <william.vinnicombe@raspberrypi.com\n> >     <mailto:william.vinnicombe@raspberrypi.com>>\n> >      >> ---\n> >      >>   src/py/libcamera/meson.build | 23 ++++++++++++-----------\n> >      >>   1 file changed, 12 insertions(+), 11 deletions(-)\n> >      >>\n> >      >> diff --git a/src/py/libcamera/meson.build\n> >     b/src/py/libcamera/meson.build\n> >      >> index f58c7198..e9e3f915 100644\n> >      >> --- a/src/py/libcamera/meson.build\n> >      >> +++ b/src/py/libcamera/meson.build\n> >      >> @@ -1,6 +1,8 @@\n> >      >>   # SPDX-License-Identifier: CC0-1.0\n> >      >>\n> >      >> -py3_dep = dependency('python3', required :\n> get_option('pycamera'))\n> >      >> +\n> >      >> +py = import('python').find_installation('python3', required :\n> >     get_option('pycamera'))\n> >      >> +py3_dep = py.dependency(required : get_option('pycamera'))\n> >      >\n> >      > Does this still work when cross-compiling ? I recall we tried the\n> >     meson\n> >      > python module, and it had problems with cross-compilation. Tomi\n> >     may know\n> >      > more.\n> >\n> >     Right. When cross-compiling, you don't want that \"[the build process]\n> >     builds them for the version of python that meson is running with\", as\n> >     meson is running (for me) in x86 environment, but the target is arm.\n> >\n> >     I'm not sure if there's been any work on fixing all that in the meson\n> >     side, but the last time I talked to them they didn't have any clear\n> >     ideas how to fix it.\n> >\n> >     Perhaps this can be solved by manually dealing with all the python\n> >     details in the meson.build file, and adding a meson option so that\n> the\n> >     user can tell which python to use.\n> >\n> >        Tomi\n> >\n>\n>","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 9FAD9C0DA4\n\tfor <parsemail@patchwork.libcamera.org>;\n\tThu, 26 Oct 2023 12:33:43 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 15E686298F;\n\tThu, 26 Oct 2023 14:33:43 +0200 (CEST)","from mail-pg1-x529.google.com (mail-pg1-x529.google.com\n\t[IPv6:2607:f8b0:4864:20::529])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 7452E61DCC\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tThu, 26 Oct 2023 14:33:40 +0200 (CEST)","by mail-pg1-x529.google.com with SMTP id\n\t41be03b00d2f7-5b856d73a12so701187a12.1\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tThu, 26 Oct 2023 05:33:40 -0700 (PDT)"],"DKIM-Signature":["v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org;\n\ts=mail; t=1698323623;\n\tbh=Jo6zagFu+VgjzFNR+WFSjBFcifv6WI/IXS9NAN6cw1Q=;\n\th=References:In-Reply-To:Date:To:Subject:List-Id:List-Unsubscribe:\n\tList-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:Cc:\n\tFrom;\n\tb=XfwhLocAZk++hJI9KPHHx70cKraBM3l9awpZ0Oe0JPo42dX761FG4P/BDsN46KI+4\n\t11EpH4cMsVyp9JYxVhrP3HdHMQ8qWt+mwtIYxB2XvJdMuhlgMiH6HYRLQV9QUBBIfD\n\tSCGFmvJYJ6hg5h2HdeeN/RM50O64um1myfF0BNFF6sFGhe3prsKwlI3aT+9hJgIN1J\n\t6nSw5iaBzCcizeqnr8xu96JM6OnzxH36JtUnQaMb+J1G/ZmMANpFMDJ84Y0AquTPuq\n\t30tAg+VrWNhakeSjvhPIBk9qnPl8shC+ryQQdumFpb1+6Sfc2kZQTZbplawPD3kBmB\n\t04FCV8IBBpvNQ==","v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=raspberrypi.com; s=google; t=1698323619; x=1698928419;\n\tdarn=lists.libcamera.org; \n\th=cc:to:subject:message-id:date:from:in-reply-to:references\n\t:mime-version:from:to:cc:subject:date:message-id:reply-to;\n\tbh=lOER5ZyfT0Ldw6T26wdePfS7VIbn0kGnaTxVIKDhyaU=;\n\tb=GnNwOR/W8UrIDBLglExAOCRjDzX0KWaHv+FrkaSCZgrMaqUMsE9MvJVCKdBrTpyz36\n\tw7pJwZr2xB5BHqOSmz4ngEcQtoIRkuDWMjaBxLjgzp4qVEqw0NOU8VLxuF0IpYakfPjy\n\t6Nma4Ay4eKsXUgiYDgGIbFrxRCyLdStkgflnsA08sM30fYflgB36LPLG7B/2E2U+MQlE\n\tS4T46Z9qaqWu4rIOVpoKuGxjjGhzT4CZ73Smg08mdHUJ0qvgSXpd1TpNW+HeZmldxZND\n\tr7xRIhXI+84/xjNTbMunQWo+mTLqvYGf2Z/8cyl8IxHld+UX8ztq85si6T1qxwlFlwPm\n\tMtAg=="],"Authentication-Results":"lancelot.ideasonboard.com; dkim=pass (2048-bit key; \n\tunprotected) header.d=raspberrypi.com\n\theader.i=@raspberrypi.com\n\theader.b=\"GnNwOR/W\"; dkim-atps=neutral","X-Google-DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=1e100.net; s=20230601; t=1698323619; x=1698928419;\n\th=cc:to:subject:message-id:date:from:in-reply-to:references\n\t:mime-version:x-gm-message-state:from:to:cc:subject:date:message-id\n\t:reply-to;\n\tbh=lOER5ZyfT0Ldw6T26wdePfS7VIbn0kGnaTxVIKDhyaU=;\n\tb=aLzkyvFyzDVE3ARCBh3S0tQxjW2ojlWbHUMkiuoIonigkWzmnn7A/lY0n8vnz/kZEC\n\tJjusmg8qUAEvejtqPzqCOY9hxhkAE4mitYwSKVNXD/vU3umHrF9mHDLyF3N2kOw1W72o\n\tAjOx3ev69WOEVyGT4Vbw9AUOI0Bb1B9VqFBVrKxb+sigGQp34lzlM4j4leH0MXLSuE8z\n\tn2mnmHFLMybYVugtmu/C4ubqnaTv1rt6bm/VKN0/vnFKZjrvJIOe93wbptsQv1dKTnlt\n\ttWlOUHwW2PSA6Vodn8+ONtGKf6PLU+yd193SajHrXB/Pm/pjR+TNiVhQ1mscp6dWBLel\n\tRXQQ==","X-Gm-Message-State":"AOJu0Yw2+YZ6Be+7I11AV87M52iCj1YvuMuWB0Cdx8cNynMMWuj/a5Rl\n\tIfEk/L5vSq32jlYpm0L18NEkoCObt2FpxipKMvrpkwxoVQSuR/he","X-Google-Smtp-Source":"AGHT+IFLqQ571+OwBKUUHkNjIlhmIBzJ8SIevmGoDyto2HY7kIQe1gRIVWXllWO+fck1MwtMKEgpium01uWyCLEzpT4=","X-Received":"by 2002:a17:90a:164f:b0:27c:f1ca:f8a6 with SMTP id\n\tx15-20020a17090a164f00b0027cf1caf8a6mr16757806pje.30.1698323618931;\n\tThu, 26 Oct 2023 05:33:38 -0700 (PDT)","MIME-Version":"1.0","References":"<20231025093649.25222-1-william.vinnicombe@raspberrypi.com>\n\t<20231025110402.GE481@pendragon.ideasonboard.com>\n\t<2a6b589d-29fb-443e-9ab8-4516bad04d71@ideasonboard.com>\n\t<CAA9M1nX=_w7VMWzqyBneEzz-ER0rOBcitAu5xkDAXKRUEpgaKQ@mail.gmail.com>\n\t<5e53f391-2508-402a-8f82-6f413362dd5e@ideasonboard.com>","In-Reply-To":"<5e53f391-2508-402a-8f82-6f413362dd5e@ideasonboard.com>","Date":"Thu, 26 Oct 2023 13:33:27 +0100","Message-ID":"<CAA9M1nXM6C9hxR8fVOL6NstbVuK_pN6WsgTr0qxb9UGm+0t18w@mail.gmail.com>","To":"Tomi Valkeinen <tomi.valkeinen@ideasonboard.com>","Content-Type":"multipart/alternative; boundary=\"0000000000000538de06089dc8cd\"","Subject":"Re: [libcamera-devel] [PATCH] py: libcamera: Improve python binding\n\tinstallation","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":"William Vinnicombe via libcamera-devel\n\t<libcamera-devel@lists.libcamera.org>","Reply-To":"William Vinnicombe <william.vinnicombe@raspberrypi.com>","Cc":"libcamera-devel@lists.libcamera.org","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"}}]