diff options
author | Daniel Narvaez <dwnarvaez@gmail.com> | 2012-11-29 16:18:29 (GMT) |
---|---|---|
committer | Daniel Narvaez <dwnarvaez@gmail.com> | 2012-11-29 16:18:29 (GMT) |
commit | 05b2c03cf3971303354b3a188fbbb0bbb8d554fc (patch) | |
tree | 48d3cd2f58036285e00fb9a1537206d514aa2eea /devbot/config.py | |
parent | 19843bd69f1ca9085e0126c6fe19a042f31cbe3f (diff) |
Make json configs a bit smarter
To get rid of the duplication in deps
Diffstat (limited to 'devbot/config.py')
-rw-r--r-- | devbot/config.py | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/devbot/config.py b/devbot/config.py index a264ccb..259c4f2 100644 --- a/devbot/config.py +++ b/devbot/config.py @@ -223,6 +223,15 @@ def load_prerequisites(): path = os.path.join(config_dir, "deps", "prerequisites.json") return json.load(open(path)) +def _filter_if(item): + if "if" not in item: + return True + + distro_info = distro.get_distro_info() + globals = { "gstreamer_version": distro_info.gstreamer_version } + + return eval(item["if"], globals) + def load_checks(): version = distro.get_distro_info().system_version @@ -231,7 +240,7 @@ def load_checks(): path = os.path.join(config_dir, "deps", "%s.json" % file) checks.extend(json.load(open(path))) - return checks + return filter(_filter_if, checks) def load_modules(): version = distro.get_distro_info().system_version |