[elbe-devel] [PATCH 09/14] Debianize - Panel factory

dion at linutronix.de dion at linutronix.de
Thu Aug 1 14:14:08 CEST 2019


From: Olivier Dion <dion at linutronix.de>

Simply register your panels to that it can automatically be detected.

Signed-off-by: Olivier Dion <dion at linutronix.de>
---
 elbepack/debianize/panels/factory.py | 31 +++++++++++++++++++++++++++++++
 1 file changed, 31 insertions(+)
 create mode 100644 elbepack/debianize/panels/factory.py

diff --git a/elbepack/debianize/panels/factory.py b/elbepack/debianize/panels/factory.py
new file mode 100644
index 00000000..3234046a
--- /dev/null
+++ b/elbepack/debianize/panels/factory.py
@@ -0,0 +1,31 @@
+# ELBE - Debian Based Embedded Rootfilesystem Builder
+# Copyright (c) 2019 Olivier Dion <dion at linutronix.de>
+#
+# SPDX-License-Identifier: GPL-3.0-or-later
+
+
+import os
+
+from elbepack.debianize.panels.uboot import UBoot
+from elbepack.debianize.panels.kernel import Kernel
+from elbepack.debianize.panels.barebox import BareBox
+
+
+panels = [
+    UBoot,
+    Kernel,
+    BareBox
+]
+
+
+def detect_panel():
+    for panel in panels:
+        match = True
+        for f in panel.match_files:
+            if not os.path.exists(f):
+                match = False
+                break
+        if match:
+            return panel()
+
+    raise KeyError
-- 
2.11.0




More information about the elbe-devel mailing list