[libcamera-devel] [PATCH 09/38] utils: ipc: add generator script

Paul Elder paul.elder at ideasonboard.com
Tue Sep 22 15:35:08 CEST 2020


We want to avoid changing our copy of mojo to make updates easier. Some
parameters in the mojo generator script needs to be changed though; add
a wrapper script that sets these parameters.

Signed-off-by: Paul Elder <paul.elder at ideasonboard.com>

---
Changes in v2:
- add descriptions to python setup
- disable pycache
---
 utils/ipc/generate.py | 21 +++++++++++++++++++++
 1 file changed, 21 insertions(+)
 create mode 100755 utils/ipc/generate.py

diff --git a/utils/ipc/generate.py b/utils/ipc/generate.py
new file mode 100755
index 00000000..3a76c37c
--- /dev/null
+++ b/utils/ipc/generate.py
@@ -0,0 +1,21 @@
+#!/usr/bin/env python3
+
+import os
+import sys
+
+sys.dont_write_bytecode = True
+
+import mojo.public.tools.bindings.mojom_bindings_generator as generator
+
+def _GetModulePath(path, output_dir):
+  return os.path.join(output_dir, path.relative_path())
+
+# Override the mojo code generator's generator list to only contain our
+# libcamera generator
+generator._BUILTIN_GENERATORS = {'libcamera': 'mojom_libcamera_generator'}
+
+# Override the mojo code generator's _GetModulePath method to not add
+# the '-module' suffix when searching for mojo modules
+generator._GetModulePath = _GetModulePath
+
+generator.main()
-- 
2.27.0



More information about the libcamera-devel mailing list