[{"id":12535,"web_url":"https://patchwork.libcamera.org/comment/12535/","msgid":"<20200916001614.GG14954@pendragon.ideasonboard.com>","date":"2020-09-16T00:16:14","subject":"Re: [libcamera-devel] [PATCH 04/23] utils: ipc: add generator script","submitter":{"id":2,"url":"https://patchwork.libcamera.org/api/people/2/","name":"Laurent Pinchart","email":"laurent.pinchart@ideasonboard.com"},"content":"Hi Paul,\n\nThank you for the patch.\n\nOn Tue, Sep 15, 2020 at 11:20:19PM +0900, Paul Elder wrote:\n> We want to avoid changing our copy of mojo to make updates easier. Some\n> parameters in the mojo generator script needs to be changed though; add\n> a wrapper script that sets these parameters.\n> \n> Signed-off-by: Paul Elder <paul.elder@ideasonboard.com>\n> ---\n>  utils/ipc/generate.py | 17 +++++++++++++++++\n>  1 file changed, 17 insertions(+)\n>  create mode 100755 utils/ipc/generate.py\n> \n> diff --git a/utils/ipc/generate.py b/utils/ipc/generate.py\n> new file mode 100755\n> index 00000000..39160aa2\n> --- /dev/null\n> +++ b/utils/ipc/generate.py\n> @@ -0,0 +1,17 @@\n> +#!/usr/bin/env python3\n> +\n> +import argparse\n\nThis doesn't seem needed.\n\n> +import os\n> +import sys\n> +import mojo.public.tools.bindings.mojom_bindings_generator as generator\n> +\n> +def _GetModulePath(path, output_dir):\n> +  return os.path.join(output_dir, path.relative_path())\n> +\n\nComments to explain what's going on with the next three lines would be useful.\n\n> +generator._BUILTIN_GENERATORS = {'libcamera': 'mojom_libcamera_generator'}\n> +generator._GetModulePath = _GetModulePath\n> +sys.path.append(os.path.join(os.path.dirname(__file__), 'utils/ipc'))\n> +\n> +generator.main()\n> +\n> +#./bindings/mojom_bindings_generator.py generate -g libcamera --bytecode_path . ./raspberrypi.mojom\n\nIs this line a leftover ?","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 A79C0C3B5B\n\tfor <parsemail@patchwork.libcamera.org>;\n\tWed, 16 Sep 2020 00:16:46 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 35FEF62E13;\n\tWed, 16 Sep 2020 02:16:46 +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 7989262C8C\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tWed, 16 Sep 2020 02:16:44 +0200 (CEST)","from pendragon.ideasonboard.com (62-78-145-57.bb.dnainternet.fi\n\t[62.78.145.57])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id F3D95FD8;\n\tWed, 16 Sep 2020 02:16:43 +0200 (CEST)"],"Authentication-Results":"lancelot.ideasonboard.com;\n\tdkim=fail reason=\"signature verification failed\" (1024-bit key;\n\tunprotected) header.d=ideasonboard.com header.i=@ideasonboard.com\n\theader.b=\"gOVT8+C6\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1600215404;\n\tbh=zkApC5PilonnmPTJvDv5ADBobdSoRLQaqGXUFJGNniM=;\n\th=Date:From:To:Cc:Subject:References:In-Reply-To:From;\n\tb=gOVT8+C6rRScsXcd3IJh0bHJLfdLs+2dsnrd/ZluloxMqPso6MRIMzh3xfvzDks6w\n\tE4n+n9RruHmg14micPG8aMKifLwvPd56yKRCjwiR58R+ZkT5Pej4iBB935+RQqSPtV\n\tASo88gILQZv6s1z/AU3s6myUxxw54Q6g8Dp/A/ns=","Date":"Wed, 16 Sep 2020 03:16:14 +0300","From":"Laurent Pinchart <laurent.pinchart@ideasonboard.com>","To":"Paul Elder <paul.elder@ideasonboard.com>","Message-ID":"<20200916001614.GG14954@pendragon.ideasonboard.com>","References":"<20200915142038.28757-1-paul.elder@ideasonboard.com>\n\t<20200915142038.28757-5-paul.elder@ideasonboard.com>","MIME-Version":"1.0","Content-Disposition":"inline","In-Reply-To":"<20200915142038.28757-5-paul.elder@ideasonboard.com>","Subject":"Re: [libcamera-devel] [PATCH 04/23] utils: ipc: add generator script","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>","Cc":"libcamera-devel@lists.libcamera.org","Content-Type":"text/plain; charset=\"us-ascii\"","Content-Transfer-Encoding":"7bit","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"}},{"id":12537,"web_url":"https://patchwork.libcamera.org/comment/12537/","msgid":"<20200916014943.GI14954@pendragon.ideasonboard.com>","date":"2020-09-16T01:49:43","subject":"Re: [libcamera-devel] [PATCH 04/23] utils: ipc: add generator script","submitter":{"id":2,"url":"https://patchwork.libcamera.org/api/people/2/","name":"Laurent Pinchart","email":"laurent.pinchart@ideasonboard.com"},"content":"On Wed, Sep 16, 2020 at 03:16:15AM +0300, Laurent Pinchart wrote:\n> Hi Paul,\n> \n> Thank you for the patch.\n> \n> On Tue, Sep 15, 2020 at 11:20:19PM +0900, Paul Elder wrote:\n> > We want to avoid changing our copy of mojo to make updates easier. Some\n> > parameters in the mojo generator script needs to be changed though; add\n> > a wrapper script that sets these parameters.\n> > \n> > Signed-off-by: Paul Elder <paul.elder@ideasonboard.com>\n> > ---\n> >  utils/ipc/generate.py | 17 +++++++++++++++++\n> >  1 file changed, 17 insertions(+)\n> >  create mode 100755 utils/ipc/generate.py\n> > \n> > diff --git a/utils/ipc/generate.py b/utils/ipc/generate.py\n> > new file mode 100755\n> > index 00000000..39160aa2\n> > --- /dev/null\n> > +++ b/utils/ipc/generate.py\n> > @@ -0,0 +1,17 @@\n> > +#!/usr/bin/env python3\n> > +\n> > +import argparse\n> \n> This doesn't seem needed.\n> \n> > +import os\n> > +import sys\n> > +import mojo.public.tools.bindings.mojom_bindings_generator as generator\n\nThis results in a __pycache__ directory being created in the source\ntree, that will be an issue when building on Chrome OS. Python 3.8\nsupports an option PYTHONPYCACHEPREFIX ([1]) to store the .pyc files in\na mirror directory tree, which we should set to point to the build\ndirectory. For earlier versions of Python, the best workaround is\npossibly to set PYTHONDONTWRITEBYTECODE ([2]) to avoid generation of\n.pyc files in the first place.\n\n[1] https://docs.python.org/3/using/cmdline.html#envvar-PYTHONPYCACHEPREFIX\n[2] https://docs.python.org/3/using/cmdline.html#envvar-PYTHONDONTWRITEBYTECODE\n\n> > +\n> > +def _GetModulePath(path, output_dir):\n> > +  return os.path.join(output_dir, path.relative_path())\n> > +\n> \n> Comments to explain what's going on with the next three lines would be useful.\n> \n> > +generator._BUILTIN_GENERATORS = {'libcamera': 'mojom_libcamera_generator'}\n> > +generator._GetModulePath = _GetModulePath\n> > +sys.path.append(os.path.join(os.path.dirname(__file__), 'utils/ipc'))\n> > +\n> > +generator.main()\n> > +\n> > +#./bindings/mojom_bindings_generator.py generate -g libcamera --bytecode_path . ./raspberrypi.mojom\n> \n> Is this line a leftover ?","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 8CF38C3B5B\n\tfor <parsemail@patchwork.libcamera.org>;\n\tWed, 16 Sep 2020 01:50:15 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id E993262E13;\n\tWed, 16 Sep 2020 03:50:14 +0200 (CEST)","from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[213.167.242.64])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 791B662C8C\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tWed, 16 Sep 2020 03:50:13 +0200 (CEST)","from pendragon.ideasonboard.com (62-78-145-57.bb.dnainternet.fi\n\t[62.78.145.57])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id 05B3757F;\n\tWed, 16 Sep 2020 03:50:12 +0200 (CEST)"],"Authentication-Results":"lancelot.ideasonboard.com;\n\tdkim=fail reason=\"signature verification failed\" (1024-bit key;\n\tunprotected) header.d=ideasonboard.com header.i=@ideasonboard.com\n\theader.b=\"OHeP3zbQ\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1600221013;\n\tbh=+iANuNj+VRZFm/y41vnd5iYFwHjJVaxMDKGYstVOccE=;\n\th=Date:From:To:Cc:Subject:References:In-Reply-To:From;\n\tb=OHeP3zbQM8358p9qcp5FzLAlMV6k4sRsP3RE5WGUkwQ2lnQcRJsmBtK1bKcMCvv30\n\tGXsd/Sau7isHfk3vwt2RvkyiNXCw2/g045vRkO7qpYOdGE7cTvdLNm3JUtgmqASgtY\n\trzhF/6a++1/opjSsmtXtsUzny417RpuEtcU1ozao=","Date":"Wed, 16 Sep 2020 04:49:43 +0300","From":"Laurent Pinchart <laurent.pinchart@ideasonboard.com>","To":"Paul Elder <paul.elder@ideasonboard.com>","Message-ID":"<20200916014943.GI14954@pendragon.ideasonboard.com>","References":"<20200915142038.28757-1-paul.elder@ideasonboard.com>\n\t<20200915142038.28757-5-paul.elder@ideasonboard.com>\n\t<20200916001614.GG14954@pendragon.ideasonboard.com>","MIME-Version":"1.0","Content-Disposition":"inline","In-Reply-To":"<20200916001614.GG14954@pendragon.ideasonboard.com>","Subject":"Re: [libcamera-devel] [PATCH 04/23] utils: ipc: add generator script","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>","Cc":"libcamera-devel@lists.libcamera.org","Content-Type":"text/plain; charset=\"us-ascii\"","Content-Transfer-Encoding":"7bit","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"}}]