summaryrefslogtreecommitdiffstats
path: root/debian/lib/python/config.py
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-19 08:03:40 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-19 08:03:40 +0000
commit6a254b9c2391d68199836601525220b5c5f8c0db (patch)
treed1e96c6ffb5ba431feee7e953a5ed15e56098248 /debian/lib/python/config.py
parentAdding upstream version 20200122. (diff)
downloadfirmware-free-6a254b9c2391d68199836601525220b5c5f8c0db.tar.xz
firmware-free-6a254b9c2391d68199836601525220b5c5f8c0db.zip
Adding debian version 20200122-4.debian/20200122-4
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to '')
-rw-r--r--debian/lib/python/config.py46
1 files changed, 46 insertions, 0 deletions
diff --git a/debian/lib/python/config.py b/debian/lib/python/config.py
new file mode 100644
index 0000000..46cc324
--- /dev/null
+++ b/debian/lib/python/config.py
@@ -0,0 +1,46 @@
+from debian_linux.config import ConfigParser, SchemaItemList
+
+class Config(dict):
+ config_name = "defines"
+
+ top_schemas = {
+ 'base': {
+ 'packages': SchemaItemList(),
+ },
+ }
+
+ package_schemas = {
+ 'base': {
+ 'files': SchemaItemList(),
+ 'support': SchemaItemList(),
+ }
+ }
+
+ def __init__(self):
+ self._read_base()
+
+ def _read_base(self):
+ config = ConfigParser(self.top_schemas)
+ config.read("debian/config/%s" % self.config_name)
+
+ packages = config['base',]['packages']
+
+ for section in iter(config):
+ real = (section[-1],) + section[:-1]
+ self[real] = config[section]
+
+ for package in packages:
+ self._read_package(package)
+
+ def _read_package(self, package):
+ config = ConfigParser(self.package_schemas)
+ config.read("debian/config/%s/%s" % (package, self.config_name))
+
+ for section in iter(config):
+ if len(section) > 1:
+ real = (section[-1], package, '_'.join(section[:-1]))
+ else:
+ real = (section[-1], package)
+ s = self.get(real, {})
+ s.update(config[section])
+ self[real] = s