[{"id":12861,"web_url":"https://patchwork.libcamera.org/comment/12861/","msgid":"<20200929041011.GA14614@pendragon.ideasonboard.com>","date":"2020-09-29T04:10:11","subject":"Re: [libcamera-devel] [PATCH 09/38] 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 22, 2020 at 10:35:08PM +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\ns/needs/need/\n\n> a wrapper script that sets these parameters.\n> \n> Signed-off-by: Paul Elder <paul.elder@ideasonboard.com>\n> \n> ---\n> Changes in v2:\n> - add descriptions to python setup\n> - disable pycache\n> ---\n>  utils/ipc/generate.py | 21 +++++++++++++++++++++\n>  1 file changed, 21 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..3a76c37c\n> --- /dev/null\n> +++ b/utils/ipc/generate.py\n> @@ -0,0 +1,21 @@\n> +#!/usr/bin/env python3\n\nMissing SPDX header.\n\nA small comment block to tell what this script does would be useful.\n\n#\n# generator.py - Wrapper around mojo to override its default behaviour without\n# modifying mojo itself.\n#\n\n> +\n> +import os\n> +import sys\n> +\n\n# Importing python code will create __pycache__ directories in the source tree,\n# which can cause issues when the build is sandboxed (for Chrome OS workon\n# ebuilds for instance). Let's disable bytecode cache to avoid this.\n\n> +sys.dont_write_bytecode = True\n\nStarting with python3.8, you could also set sys.pycache_prefix. Should\nthis be recorded in a TODO comment ?\n\n> +\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> +# Override the mojo code generator's generator list to only contain our\n> +# libcamera generator\n> +generator._BUILTIN_GENERATORS = {'libcamera': 'mojom_libcamera_generator'}\n> +\n> +# Override the mojo code generator's _GetModulePath method to not add\n> +# the '-module' suffix when searching for mojo modules\n\nCould you expend this comment to explain why this is needed ?\n\nReviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\n\n> +generator._GetModulePath = _GetModulePath\n> +\n> +generator.main()","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 38F90C3B5B\n\tfor <parsemail@patchwork.libcamera.org>;\n\tTue, 29 Sep 2020 04:10:49 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id A64696214D;\n\tTue, 29 Sep 2020 06:10:48 +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 026E76035E\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tTue, 29 Sep 2020 06:10:46 +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 601C7540;\n\tTue, 29 Sep 2020 06:10:46 +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=\"Kq0b6893\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1601352646;\n\tbh=xi1Dyiup60NccXOCmx5qWiAk/o4p7VUfzV8uifJ58ok=;\n\th=Date:From:To:Cc:Subject:References:In-Reply-To:From;\n\tb=Kq0b6893FpPokvyd/VFpAp6BSDu5VwsZw90x4t7s6O1lwO3OjecXFGiuMDlDhCRpe\n\tCrWcIy6MFPk5J7MWO93OipK4JKpgzddg0h8aggNzydlFefQa5OJJTAEG9Zfh3j6m9f\n\tsQzlArRRpjgPfoqaIrlRGZWvtg8JB7IMm6VA8b2s=","Date":"Tue, 29 Sep 2020 07:10:11 +0300","From":"Laurent Pinchart <laurent.pinchart@ideasonboard.com>","To":"Paul Elder <paul.elder@ideasonboard.com>","Message-ID":"<20200929041011.GA14614@pendragon.ideasonboard.com>","References":"<20200922133537.258098-1-paul.elder@ideasonboard.com>\n\t<20200922133537.258098-10-paul.elder@ideasonboard.com>","MIME-Version":"1.0","Content-Disposition":"inline","In-Reply-To":"<20200922133537.258098-10-paul.elder@ideasonboard.com>","Subject":"Re: [libcamera-devel] [PATCH 09/38] 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>"}}]