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/system.py | |
parent | 19843bd69f1ca9085e0126c6fe19a042f31cbe3f (diff) |
Make json configs a bit smarter
To get rid of the duplication in deps
Diffstat (limited to 'devbot/system.py')
-rw-r--r-- | devbot/system.py | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/devbot/system.py b/devbot/system.py index 0bbfe8d..5757424 100644 --- a/devbot/system.py +++ b/devbot/system.py @@ -77,6 +77,17 @@ def _print_checks(checks): for check in checks: print "[%s] %s" % (check["checker"], check["check"]) +def _eval_check_if(check): + if "check_if" not in check: + return True + + distro_info = distro.get_distro_info() + globals = { "distro": "%s-%s" % (distro_info.name, distro_info.version) } + + print eval(check["check_if"], globals) + + return eval(check["check_if"], globals) == "True" + def run_checks(package_manager, checks, packages): distro_info = distro.get_distro_info() @@ -85,6 +96,10 @@ def run_checks(package_manager, checks, packages): to_install = [] for check in checks: + if not _eval_check_if(check): + print "uuuuu" + continue + checker = checkers[check["checker"]] if checker(check["check"]): if distro_info.name in packages[check["name"]]: |