[libcamera-devel] [PATCH v4 09/12] utils: libtuning: parsers: Add yaml parser

Paul Elder paul.elder at ideasonboard.com
Thu Nov 24 12:35:47 CET 2022


Add a parser to libtuning for parsing configuration files in yaml
format.

At the moment it doesn't parse anything and simply returns an empty
config. This is fine for the time being, as the only user of it is the
rkisp1 tuning script, which only has an LSC module which doesn't consume
anything from the configuration file. When a module comes around that
requires the yaml parser, it can be implemented then.

Signed-off-by: Paul Elder <paul.elder at ideasonboard.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart at ideasonboard.com>

---
Changes in v3:
- add file description
- remove indirection from fake polymorphism
- update commit message to reflect the fact that it doesn't actually do
  anything at the moment
---
 utils/tuning/libtuning/parsers/__init__.py    |  1 +
 utils/tuning/libtuning/parsers/yaml_parser.py | 17 +++++++++++++++++
 2 files changed, 18 insertions(+)
 create mode 100644 utils/tuning/libtuning/parsers/yaml_parser.py

diff --git a/utils/tuning/libtuning/parsers/__init__.py b/utils/tuning/libtuning/parsers/__init__.py
index 9d20d2fc..022c1e5d 100644
--- a/utils/tuning/libtuning/parsers/__init__.py
+++ b/utils/tuning/libtuning/parsers/__init__.py
@@ -3,3 +3,4 @@
 # Copyright (C) 2022, Paul Elder <paul.elder at ideasonboard.com>
 
 from libtuning.parsers.raspberrypi_parser import RaspberryPiParser
+from libtuning.parsers.yaml_parser import YamlParser
diff --git a/utils/tuning/libtuning/parsers/yaml_parser.py b/utils/tuning/libtuning/parsers/yaml_parser.py
new file mode 100644
index 00000000..5c1673a5
--- /dev/null
+++ b/utils/tuning/libtuning/parsers/yaml_parser.py
@@ -0,0 +1,17 @@
+# SPDX-License-Identifier: GPL-2.0-or-later
+#
+# Copyright (C) 2022, Paul Elder <paul.elder at ideasonboard.com>
+#
+# yaml_parser.py - Parser for YAML format config file
+
+from .parser import Parser
+
+
+class YamlParser(Parser):
+    def __init__(self):
+        super().__init__()
+
+    # \todo Implement this (it's fine for now as we don't need a config for
+    # rkisp1 LSC, which is the only user of this so far)
+    def parse(self, config_file: str, modules: list) -> (dict, list):
+        return {}, []
-- 
2.35.1



More information about the libcamera-devel mailing list