summaryrefslogtreecommitdiff
path: root/lib/loader
diff options
context:
space:
mode:
authorDaniel Friesel <daniel.friesel@uos.de>2022-04-01 09:25:38 +0200
committerDaniel Friesel <daniel.friesel@uos.de>2022-04-01 09:25:38 +0200
commit97d4e1a3c5fce0459d227f4980fbe5ca7e29db4a (patch)
treefdd4881794d88c3df7aab8d60bc77d258a413d59 /lib/loader
parenta590c804cbf121c037d087a0b4196586e063f0fb (diff)
kconfig loader: expose .kconfig_root
Diffstat (limited to 'lib/loader')
-rw-r--r--lib/loader/kconfig.py28
1 files changed, 15 insertions, 13 deletions
diff --git a/lib/loader/kconfig.py b/lib/loader/kconfig.py
index 48f89bc..2c274cf 100644
--- a/lib/loader/kconfig.py
+++ b/lib/loader/kconfig.py
@@ -11,19 +11,21 @@ class KConfigAttributes:
def __init__(self, kconfig_path, datadir):
experiments = list()
failed_experiments = list()
- for direntry in os.listdir(datadir):
- config_path = f"{datadir}/{direntry}/.config"
- attr_path = f"{datadir}/{direntry}/attributes.json"
- metadata_path = f"{datadir}/{direntry}/metadata"
- if os.path.exists(attr_path):
- experiments.append((config_path, attr_path))
- elif os.path.exists(config_path):
- failed_experiments.append(config_path)
-
- kconfig_dir = "/".join(kconfig_path.split("/")[:-1])
-
- with cd(kconfig_dir):
- kconf = kconfiglib.Kconfig(kconfig_path)
+ if not datadir is None:
+ for direntry in os.listdir(datadir):
+ config_path = f"{datadir}/{direntry}/.config"
+ attr_path = f"{datadir}/{direntry}/attributes.json"
+ metadata_path = f"{datadir}/{direntry}/metadata"
+ if os.path.exists(attr_path):
+ experiments.append((config_path, attr_path))
+ elif os.path.exists(config_path):
+ failed_experiments.append(config_path)
+
+ self.kconfig_root = "/".join(kconfig_path.split("/")[:-1])
+ kconfig_file = kconfig_path.split("/")[-1]
+
+ with cd(self.kconfig_root):
+ kconf = kconfiglib.Kconfig(kconfig_file)
self.kconf = kconf
self.kconfig_hash = self.file_hash(kconfig_path)