diff options
author | Daniel Friesel <daniel.friesel@uos.de> | 2021-10-27 15:03:07 +0200 |
---|---|---|
committer | Daniel Friesel <daniel.friesel@uos.de> | 2021-10-27 15:03:07 +0200 |
commit | 6e56f018f6582b315e1af6b5ea2c6bbd5bb99a62 (patch) | |
tree | 6de91e2dc4d812838a8cc516830fc7144ef6a44d | |
parent | 24c645137264c2f9d9146cda73677a67ec815ca3 (diff) |
kconfig: add DFATOOL_KCONF_IGNORE_NUMERIC / _STRING options
-rw-r--r-- | README.md | 3 | ||||
-rw-r--r-- | lib/loader/kconfig.py | 11 |
2 files changed, 13 insertions, 1 deletions
@@ -31,3 +31,6 @@ The following variables may be set to alter the behaviour of dfatool components. | `DFATOOL_DRIFT_COMPENSATION_PENALTY` | 0 .. 100 (default: majority vote over several penalties) | Specify penalty for ruptures.py PELT changepoint petection | | `DFATOOL_DTREE_ENABLED` | 0, **1** | Use decision trees in get\_fitted | | `DFATOOL_DTREE_FUNCTION_LEAVES` | 0, **1** | Use functions (fitted via linear regression) in decision tree leaves when modeling numeric parameters with at least three distinct values. If 0, integer parameters are treated as enums instead. | +| `DFATOOL_KCONF_WITH_CHOICE_NODES` | 0, **1** | Generate enum parameters from kconfig choice nodes; ignore corresponding boolean config options. | +| `DFATOOL_KCONF_IGNORE_NUMERIC` | **0**, 1 | Ignore numeric (int/hex) configuration options. Useful for comparison with CART/DECART. | +| `DFATOOL_KCONF_IGNORE_STRING` | **0**, 1 | Ignore string configuration options. Useful for comparison with CART/DECART. | diff --git a/lib/loader/kconfig.py b/lib/loader/kconfig.py index 42181c9..ef0bc65 100644 --- a/lib/loader/kconfig.py +++ b/lib/loader/kconfig.py @@ -32,12 +32,21 @@ class KConfigAttributes: if "/" in kconfig_path: self.kconfig_dir = kconfig_path.split("/")[-2] + accepted_symbol_types = "bool tristate int string hex".split() + + if bool(int(os.getenv("DFATOOL_KCONF_IGNORE_NUMERIC", 0))): + accepted_symbol_types.remove("int") + accepted_symbol_types.remove("hex") + + if bool(int(os.getenv("DFATOOL_KCONF_IGNORE_STRING", 0))): + accepted_symbol_types.remove("string") + self.symbol_names = sorted( map( lambda sym: sym.name, filter( lambda sym: kconfiglib.TYPE_TO_STR[sym.type] - in ("bool", "tristate", "int", "string", "hex"), + in accepted_symbol_types, kconf.syms.values(), ), ) |