[{"id":22957,"web_url":"https://patchwork.libcamera.org/comment/22957/","msgid":"<c637cd37-0277-d06f-8c89-9d3c29c0397c@ideasonboard.com>","date":"2022-05-16T14:43:20","subject":"Re: [libcamera-devel] [PATCH] py: Use Meson python module","submitter":{"id":109,"url":"https://patchwork.libcamera.org/api/people/109/","name":"Tomi Valkeinen","email":"tomi.valkeinen@ideasonboard.com"},"content":"Hi,\n\nOn 15/05/2022 20:02, Chris Mayo via libcamera-devel wrote:\n> Detection with dependency('python3') can fail because not all\n> distributions install python-3.pc. Installation is invalid if\n> site-packages is not below get_option('libdir').\n\nI don't understand the comment about libdir. Do you mean that this \ninstalls to the wrong dir if the platform's python site-packages are not \nlocated under get_option('libdir')?\n\n> Signed-off-by: Chris Mayo <aklhfex@gmail.com>\n> ---\n>   src/py/libcamera/meson.build | 27 ++++++++++++---------------\n>   1 file changed, 12 insertions(+), 15 deletions(-)\n> \n> diff --git a/src/py/libcamera/meson.build b/src/py/libcamera/meson.build\n> index 0cd7c75b..130c1be6 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> +pymod = import('python')\n> +py3 = pymod.find_installation('python3')\n> +py3_dep = py3.dependency(required : get_option('pycamera'))\n>   \n>   if not py3_dep.found()\n>       pycamera_enabled = false\n> @@ -44,21 +46,16 @@ pycamera_args = [\n>       '-DLIBCAMERA_BASE_PRIVATE',\n>   ]\n>   \n> -destdir = get_option('libdir') / ('python' + py3_dep.version()) / 'site-packages' / 'libcamera'\n> +py3.extension_module('_libcamera',\n> +                     pycamera_sources,\n> +                     install : true,\n> +                     dependencies : pycamera_deps,\n> +                     cpp_args : pycamera_args,\n> +                     subdir : 'libcamera')\n\nThe problem is that this doesn't work with cross-compiling. When I \ncompile for ARM, I get \"_libcamera.cpython-310-x86_64-linux-gnu.so\".\n\nIf I remember right, I discussed the use of py.extension_module() on \nmeson chat, but the conclusion was that it doesn't work for \ncross-compiling. This may have changed, but at least here it doesn't work.\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> -\n> -run_command('ln', '-fsT', '../../../../src/py/libcamera/__init__.py',\n> -            meson.current_build_dir() / '__init__.py',\n> -            check: true)\n\nWas there a reason to remove this symlink? I want to be able to use the \nbindings without installing. That's the purpose of the symlink.\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 11CB8C0F2A\n\tfor <parsemail@patchwork.libcamera.org>;\n\tMon, 16 May 2022 14:43:26 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 5F23A65653;\n\tMon, 16 May 2022 16:43:25 +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 D3F4F61FB8\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tMon, 16 May 2022 16:43:23 +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 4F23D484;\n\tMon, 16 May 2022 16:43:23 +0200 (CEST)"],"DKIM-Signature":["v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org;\n\ts=mail; t=1652712205;\n\tbh=Ux6mlLAhPYxupa5WtTQ81kFMPwZXsjF8HvpEDGXmJpw=;\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:\n\tFrom;\n\tb=HEdzRHHKwMjlFy4D3m3zxKZL0Wim9jDGN03K1Nx3NMM4qK3aqNDo+nwNSQmX1zgND\n\tu0jaRCVFDBvRl6S5vt8k11Wvy8H9OzRCO4JEo7viBANLEbj1pyMA6CL4V6G177fK32\n\th3lRBDauOAtdd/SQ3fdb30+d4L6w00zXMg75n7ccBfDMpqHQC4yJ50HHcMnHaA68bE\n\tmhI5p3ivks6T1qf3buX6rDZIFCKtpr+bZDcbtbXPgP0QPTKPnPULHYNKDrye5WPYSx\n\tsmYdpvgL2VcbGaQ8/UuFmsAAG86WGKWTrIDMxzC0BwpsfMm03h09owryat3t99RWAg\n\tdxginZjaZ9ifg==","v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1652712203;\n\tbh=Ux6mlLAhPYxupa5WtTQ81kFMPwZXsjF8HvpEDGXmJpw=;\n\th=Date:Subject:To:References:From:In-Reply-To:From;\n\tb=cOoeOOg+gpYEfUOt5Aj2ULhRJ8tYUxJii3AgHbnt9rqWV1fi1+KH2TZtk/4DzbuwM\n\tJsm7jtwR04k3h+isY50LIez+u3Y7RkT8OW7dQaWnDxa71ob0QwyjwN+aHDc1Ek6nki\n\tenDqojBJgbmqINznjkMmDoXkb4dXbpUgUYAGqvX0="],"Authentication-Results":"lancelot.ideasonboard.com; dkim=pass (1024-bit key; \n\tunprotected) header.d=ideasonboard.com\n\theader.i=@ideasonboard.com\n\theader.b=\"cOoeOOg+\"; dkim-atps=neutral","Message-ID":"<c637cd37-0277-d06f-8c89-9d3c29c0397c@ideasonboard.com>","Date":"Mon, 16 May 2022 17:43:20 +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":"Chris Mayo <aklhfex@gmail.com>, libcamera-devel@lists.libcamera.org","References":"<20220515170253.53075-1-aklhfex@gmail.com>","In-Reply-To":"<20220515170253.53075-1-aklhfex@gmail.com>","Content-Type":"text/plain; charset=UTF-8; format=flowed","Content-Transfer-Encoding":"7bit","Subject":"Re: [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":"<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>","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"}},{"id":22959,"web_url":"https://patchwork.libcamera.org/comment/22959/","msgid":"<CAHTui8KVj-2UJH1xpTsTyeHHTnfBHtoWyFr3Xp5b2i2qP1bT2g@mail.gmail.com>","date":"2022-05-16T19:01:05","subject":"Re: [libcamera-devel] [PATCH] py: Use Meson python module","submitter":{"id":122,"url":"https://patchwork.libcamera.org/api/people/122/","name":"Chris Mayo","email":"aklhfex@gmail.com"},"content":"> Hi,\n>\n> On 15/05/2022 20:02, Chris Mayo via libcamera-devel wrote:\n> > Detection with dependency('python3') can fail because not all\n> > distributions install python-3.pc. Installation is invalid if\n> > site-packages is not below get_option('libdir').\n>\n> I don't understand the comment about libdir. Do you mean that this\n> installs to the wrong dir if the platform's python site-packages are not\n> located under get_option('libdir')?\n\nYes. On Gentoo Linux:\n\n/usr/lib/python3.10/site-packages/libcamera\n\nand:\n\n/usr/lib64/libcamera.so\n\n> > Signed-off-by: Chris Mayo <aklhfex@gmail.com>\n> > ---\n> >   src/py/libcamera/meson.build | 27 ++++++++++++---------------\n> >   1 file changed, 12 insertions(+), 15 deletions(-)\n> >\n> > diff --git a/src/py/libcamera/meson.build b/src/py/libcamera/meson.build\n> > index 0cd7c75b..130c1be6 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> > +pymod = import('python')\n> > +py3 = pymod.find_installation('python3')\n> > +py3_dep = py3.dependency(required : get_option('pycamera'))\n> >\n> >   if not py3_dep.found()\n> >       pycamera_enabled = false\n> > @@ -44,21 +46,16 @@ pycamera_args = [\n> >       '-DLIBCAMERA_BASE_PRIVATE',\n> >   ]\n> >\n> > -destdir = get_option('libdir') / ('python' + py3_dep.version()) / 'site-packages' / 'libcamera'\n> > +py3.extension_module('_libcamera',\n> > +                     pycamera_sources,\n> > +                     install : true,\n> > +                     dependencies : pycamera_deps,\n> > +                     cpp_args : pycamera_args,\n> > +                     subdir : 'libcamera')\n>\n> The problem is that this doesn't work with cross-compiling. When I\n> compile for ARM, I get \"_libcamera.cpython-310-x86_64-linux-gnu.so\".\n>\n> If I remember right, I discussed the use of py.extension_module() on\n> meson chat, but the conclusion was that it doesn't work for\n> cross-compiling. This may have changed, but at least here it doesn't work.\n\nOK. Instead of using py.extension_module() this works for me:\n\ndestdir = py3.get_install_dir() / 'libcamera'\n\nStill using the Meson python module as before.\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> > -\n> > -run_command('ln', '-fsT', '../../../../src/py/libcamera/__init__.py',\n> > -            meson.current_build_dir() / '__init__.py',\n> > -            check: true)\n>\n> Was there a reason to remove this symlink? I want to be able to use the\n> bindings without installing. That's the purpose of the symlink.\n\nNo, that's fine it doesn't cause any problems.\n\n>   Tomi\n\n\nOn Mon, 16 May 2022 at 15:43, Tomi Valkeinen\n<tomi.valkeinen@ideasonboard.com> wrote:\n>\n> Hi,\n>\n> On 15/05/2022 20:02, Chris Mayo via libcamera-devel wrote:\n> > Detection with dependency('python3') can fail because not all\n> > distributions install python-3.pc. Installation is invalid if\n> > site-packages is not below get_option('libdir').\n>\n> I don't understand the comment about libdir. Do you mean that this\n> installs to the wrong dir if the platform's python site-packages are not\n> located under get_option('libdir')?\n>\n> > Signed-off-by: Chris Mayo <aklhfex@gmail.com>\n> > ---\n> >   src/py/libcamera/meson.build | 27 ++++++++++++---------------\n> >   1 file changed, 12 insertions(+), 15 deletions(-)\n> >\n> > diff --git a/src/py/libcamera/meson.build b/src/py/libcamera/meson.build\n> > index 0cd7c75b..130c1be6 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> > +pymod = import('python')\n> > +py3 = pymod.find_installation('python3')\n> > +py3_dep = py3.dependency(required : get_option('pycamera'))\n> >\n> >   if not py3_dep.found()\n> >       pycamera_enabled = false\n> > @@ -44,21 +46,16 @@ pycamera_args = [\n> >       '-DLIBCAMERA_BASE_PRIVATE',\n> >   ]\n> >\n> > -destdir = get_option('libdir') / ('python' + py3_dep.version()) / 'site-packages' / 'libcamera'\n> > +py3.extension_module('_libcamera',\n> > +                     pycamera_sources,\n> > +                     install : true,\n> > +                     dependencies : pycamera_deps,\n> > +                     cpp_args : pycamera_args,\n> > +                     subdir : 'libcamera')\n>\n> The problem is that this doesn't work with cross-compiling. When I\n> compile for ARM, I get \"_libcamera.cpython-310-x86_64-linux-gnu.so\".\n>\n> If I remember right, I discussed the use of py.extension_module() on\n> meson chat, but the conclusion was that it doesn't work for\n> cross-compiling. This may have changed, but at least here it doesn't work.\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> > -\n> > -run_command('ln', '-fsT', '../../../../src/py/libcamera/__init__.py',\n> > -            meson.current_build_dir() / '__init__.py',\n> > -            check: true)\n>\n> Was there a reason to remove this symlink? I want to be able to use the\n> bindings without installing. That's the purpose of the symlink.\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 41179C3256\n\tfor <parsemail@patchwork.libcamera.org>;\n\tMon, 16 May 2022 19:01:19 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 70F026565A;\n\tMon, 16 May 2022 21:01:18 +0200 (CEST)","from mail-lf1-x132.google.com (mail-lf1-x132.google.com\n\t[IPv6:2a00:1450:4864:20::132])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 455F861FB8\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tMon, 16 May 2022 21:01:17 +0200 (CEST)","by mail-lf1-x132.google.com with SMTP id f4so14639694lfu.12\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tMon, 16 May 2022 12:01:17 -0700 (PDT)"],"DKIM-Signature":["v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org;\n\ts=mail; t=1652727678;\n\tbh=RoOlqyErg6E49y0elyI3oMkQXbntX+p/BnmPRqe3beM=;\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=ZkLLSlQ92x+9jrAotfPIaWVNjdafAPIIf5OHp4/CUOLFRHcaVxJALxaW+1BCMTbbt\n\tt9aqvEc42caQJJbduuoZH+m01Wcf6sV7u2b348awmvJ0yOfscjr8XbRhBdEErjY03U\n\tiWft4YRq05LXyqil16iYnktxaQugIV0ecaQCUeuvWLHZswkjkh16NU2SmTPvI3vxz6\n\tJg+r7tQVO/g9iEUvRx8uDWheQoQBS4qdrzguLQYueFgY9yQrYlV8Q3Xo9Hc86m2vpO\n\tRwOu8SbfzxCaCEsF6b6bbGDIfFsUwTjV48SPhe9FMbq9yQd+eXFqfOAvU2BFQPR6yD\n\tXGzgPOoL6XMcA==","v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112;\n\th=mime-version:references:in-reply-to:from:date:message-id:subject:to\n\t:cc; bh=zCILaBVQFZTqX/NY62bsPAEM8yAIq3LmAYmfvZrWQSU=;\n\tb=H5gRl8qf71ziCy2vjS5X9K63yVybxV/H3VoDckzgaj+tuqrzwmQuPoazyJZHuIA6AI\n\t3BmP+XJn6fC9mGahzm7a80UgXBftAjjodAW/yV3vnyDItqgyQl9sZNhSKKJMulHhORYb\n\t+DywczDJlxeKNHu8z+02dbiSqDzpfzltqQDdy1orWJ3WKXRiaIQjVVXWDDACKk8/uCGz\n\ttaGwohPv7yOCvS8i97m0LWwPVQGyFUFnfiKUIkADfwBEIifoT9ukxZcsSsSQaCkY2Hn6\n\tAiEQA1EA1cYdLFkrDqbS/lIcPczNIl591OIPQJuW3yVq1XVy7Qx/QetrGA2FOGUUGK86\n\t5WXg=="],"Authentication-Results":"lancelot.ideasonboard.com; dkim=pass (2048-bit key; \n\tunprotected) header.d=gmail.com header.i=@gmail.com\n\theader.b=\"H5gRl8qf\"; dkim-atps=neutral","X-Google-DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=1e100.net; s=20210112;\n\th=x-gm-message-state:mime-version:references:in-reply-to:from:date\n\t:message-id:subject:to:cc;\n\tbh=zCILaBVQFZTqX/NY62bsPAEM8yAIq3LmAYmfvZrWQSU=;\n\tb=A//FmTDZ1nU/4LpDKEUzKTdy6aUGmUvlRzjV86ZnQv4hsBLgmaiHZ4tV5hRkHa5doH\n\tVy2J/ziG9zLC6PkeJQFP95ybLeVAwweM8PPJ9TocrnXBo9JU8Y6D3kAw9hPo/S7/X7rU\n\tLlSaChMw4wIPOLf7nBjH8iZBRCt0Zuz6u+uJxP8IdVmGM5GWRdShZujAam5SQQHCSjO4\n\tsVo4fIep5CP2YEBPwAcAnm1Iy7kA7WBQVlZgdU/VfM+EggVNMzD1KiGkKaZSrWizF5GG\n\tFNEGv/SP14QQ6jMF1+GUirwdhA2U3F0a2CxiCZozwoDAZHdRqj9Seji+00OG2b/ViXTT\n\tDDzA==","X-Gm-Message-State":"AOAM5317jGjqG0rMf/rDtVqqctt1P3hKHUU3v7lld0R3sQgQ1LZjN/rh\n\tr6J3uWaSDqbJBnOg1eVey2vSclTIkj77oyd4V4IxSfEP+pQ=","X-Google-Smtp-Source":"ABdhPJzL5tubuekmN1p1kKcmp0d1jZ/ivapGiPkID7lpo4YFf0WhZCj19gJK5CY//K6S8wAfgH0Kv54LxvRq67184xo=","X-Received":"by 2002:a05:6512:2295:b0:473:b840:75f3 with SMTP id\n\tf21-20020a056512229500b00473b84075f3mr13835396lfu.513.1652727676421;\n\tMon, 16 May 2022 12:01:16 -0700 (PDT)","MIME-Version":"1.0","References":"<20220515170253.53075-1-aklhfex@gmail.com>\n\t<c637cd37-0277-d06f-8c89-9d3c29c0397c@ideasonboard.com>","In-Reply-To":"<c637cd37-0277-d06f-8c89-9d3c29c0397c@ideasonboard.com>","Date":"Mon, 16 May 2022 20:01:05 +0100","Message-ID":"<CAHTui8KVj-2UJH1xpTsTyeHHTnfBHtoWyFr3Xp5b2i2qP1bT2g@mail.gmail.com>","To":"Tomi Valkeinen <tomi.valkeinen@ideasonboard.com>","Content-Type":"text/plain; charset=\"UTF-8\"","Subject":"Re: [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":"<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":"Chris Mayo via libcamera-devel <libcamera-devel@lists.libcamera.org>","Reply-To":"Chris Mayo <aklhfex@gmail.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":22960,"web_url":"https://patchwork.libcamera.org/comment/22960/","msgid":"<df291247-d3b9-a8dd-b9df-c41bda3fdb8a@ideasonboard.com>","date":"2022-05-17T06:53:43","subject":"Re: [libcamera-devel] [PATCH] py: Use Meson python module","submitter":{"id":109,"url":"https://patchwork.libcamera.org/api/people/109/","name":"Tomi Valkeinen","email":"tomi.valkeinen@ideasonboard.com"},"content":"On 16/05/2022 22:01, Chris Mayo wrote:\n>> Hi,\n>>\n>> On 15/05/2022 20:02, Chris Mayo via libcamera-devel wrote:\n>>> Detection with dependency('python3') can fail because not all\n>>> distributions install python-3.pc. Installation is invalid if\n>>> site-packages is not below get_option('libdir').\n>>\n>> I don't understand the comment about libdir. Do you mean that this\n>> installs to the wrong dir if the platform's python site-packages are not\n>> located under get_option('libdir')?\n> \n> Yes. On Gentoo Linux:\n> \n> /usr/lib/python3.10/site-packages/libcamera\n> \n> and:\n> \n> /usr/lib64/libcamera.so\n> \n>>> Signed-off-by: Chris Mayo <aklhfex@gmail.com>\n>>> ---\n>>>    src/py/libcamera/meson.build | 27 ++++++++++++---------------\n>>>    1 file changed, 12 insertions(+), 15 deletions(-)\n>>>\n>>> diff --git a/src/py/libcamera/meson.build b/src/py/libcamera/meson.build\n>>> index 0cd7c75b..130c1be6 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>>> +pymod = import('python')\n>>> +py3 = pymod.find_installation('python3')\n>>> +py3_dep = py3.dependency(required : get_option('pycamera'))\n>>>\n>>>    if not py3_dep.found()\n>>>        pycamera_enabled = false\n>>> @@ -44,21 +46,16 @@ pycamera_args = [\n>>>        '-DLIBCAMERA_BASE_PRIVATE',\n>>>    ]\n>>>\n>>> -destdir = get_option('libdir') / ('python' + py3_dep.version()) / 'site-packages' / 'libcamera'\n>>> +py3.extension_module('_libcamera',\n>>> +                     pycamera_sources,\n>>> +                     install : true,\n>>> +                     dependencies : pycamera_deps,\n>>> +                     cpp_args : pycamera_args,\n>>> +                     subdir : 'libcamera')\n>>\n>> The problem is that this doesn't work with cross-compiling. When I\n>> compile for ARM, I get \"_libcamera.cpython-310-x86_64-linux-gnu.so\".\n>>\n>> If I remember right, I discussed the use of py.extension_module() on\n>> meson chat, but the conclusion was that it doesn't work for\n>> cross-compiling. This may have changed, but at least here it doesn't work.\n> \n> OK. Instead of using py.extension_module() this works for me:\n> \n> destdir = py3.get_install_dir() / 'libcamera'\n\nFor me, when not cross-compiling, py3.get_install_dir() returns \n\"/usr/local/lib/python3/dist-packages/\". Afaics, that is not correct, as \n\"python3 -m site\" doesn't contain that dir, but does contain, e.g. :\n\n     '/usr/local/lib/python3.10/dist-packages',\n     '/usr/lib/python3/dist-packages',\n\nWhen I cross-compile, py3.get_install_dir() again returns the same path \nhinting that the py3 is really the host python (as also indicated by the \nmodule name). On my ARM device, \"python3 -m site\" returns \n'/usr/lib/python3.10/site-packages'.\n\nSo... the meson python module just seems to be totally broken. Or I'm \nsomehow confused. I admit I know quite little about Python installations.\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 505C8C3256\n\tfor <parsemail@patchwork.libcamera.org>;\n\tTue, 17 May 2022 06:53:50 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 819416041B;\n\tTue, 17 May 2022 08:53:49 +0200 (CEST)","from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[213.167.242.64])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 6B3E86041B\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tTue, 17 May 2022 08:53:47 +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 CA33F475;\n\tTue, 17 May 2022 08:53:46 +0200 (CEST)"],"DKIM-Signature":["v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org;\n\ts=mail; t=1652770429;\n\tbh=ShSPDf1X9HzIDWoXjYsx26bIRSuj1PvKYwrGuI619iI=;\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=DyWRFCNlODJh2yG/Sq+l36uoK6LABWWJPp3/bZK8bSvEM6TSJpEuj9+JQyMO2ci9u\n\tvHq9URKXkw9JNn00d3CTMnq/BPTDU3HOCkYspJatSLsqx2y1bS01XJhxcv53tjMxvP\n\tMJ5FDh9JzcUxSTx7qH9wL+XakPDW93Yr5ev1VpBdDVGt/EbsvjzHOjNfD760uWVNLe\n\tccCVp6O70x0NsFEf+582schK1UYuMCIHEyXrAfr1kBNIwnSWWr9n8thRxCZJ0dp6N1\n\tB2dySQVNnMBZ1+qs4GuVPA8Ca38EgkVIxqQdql02aSILF04qK4FWTNo5JZ8BoWQBeb\n\tWVfX09MDfhs1w==","v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1652770427;\n\tbh=ShSPDf1X9HzIDWoXjYsx26bIRSuj1PvKYwrGuI619iI=;\n\th=Date:Subject:To:Cc:References:From:In-Reply-To:From;\n\tb=d0S5tbqr/vU4NJkFus3RvUa9/yof1eT6sGmn53QzCUlzM6eepCg6eZ2yYFFsvUUPR\n\t3M15XHkuWdbpul9kzNmlnw8WtwTR+Y4yPtHkQLS7XvLs2UD4E+aVAsV0uTw+zro0Av\n\tkI9+4Fl7jhEc/cHAOYWO7OxNUqfafFeQxCZOACLQ="],"Authentication-Results":"lancelot.ideasonboard.com; dkim=pass (1024-bit key; \n\tunprotected) header.d=ideasonboard.com\n\theader.i=@ideasonboard.com\n\theader.b=\"d0S5tbqr\"; dkim-atps=neutral","Message-ID":"<df291247-d3b9-a8dd-b9df-c41bda3fdb8a@ideasonboard.com>","Date":"Tue, 17 May 2022 09:53:43 +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":"Chris Mayo <aklhfex@gmail.com>","References":"<20220515170253.53075-1-aklhfex@gmail.com>\n\t<c637cd37-0277-d06f-8c89-9d3c29c0397c@ideasonboard.com>\n\t<CAHTui8KVj-2UJH1xpTsTyeHHTnfBHtoWyFr3Xp5b2i2qP1bT2g@mail.gmail.com>","In-Reply-To":"<CAHTui8KVj-2UJH1xpTsTyeHHTnfBHtoWyFr3Xp5b2i2qP1bT2g@mail.gmail.com>","Content-Type":"text/plain; charset=UTF-8; format=flowed","Content-Transfer-Encoding":"7bit","Subject":"Re: [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":"<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>"}}]