diff options
author | Daniel Narvaez <dwnarvaez@gmail.com> | 2012-11-14 15:32:49 (GMT) |
---|---|---|
committer | Daniel Narvaez <dwnarvaez@gmail.com> | 2012-11-14 15:40:37 (GMT) |
commit | 66dc2e7ea7011ae63e1d404ebffeaa7782a7f2f5 (patch) | |
tree | a862db846c2bdb303a96108502402115eef40693 /devbot/config.py | |
parent | f83756431a5b6f8551f0902655ca39bf18a5e5b0 (diff) |
Refactor check-system to use a devbot module
This is necessary to be able to share code, all
the commands will be gradually refactored to
follow this pattern.
Diffstat (limited to 'devbot/config.py')
-rw-r--r-- | devbot/config.py | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/devbot/config.py b/devbot/config.py new file mode 100644 index 0000000..b63c6e6 --- /dev/null +++ b/devbot/config.py @@ -0,0 +1,32 @@ +import json +import os + +from devbot import distro + +config_path = None + +def set_path(path): + global config_path + config_path = path + +def load_packages(): + packages = _load_deps_json("packages-%s" % distro.get_system_version()) + +def load_prerequisites(): + return _load_deps_json("prerequisites") + +def load_checks(): + version = distro.get_system_version() + + checks = [] + checks.extend(_load_deps_json("system")) + checks.extend(_load_deps_json("sugar-build")) + checks.extend(_load_deps_json("sugar-buildtime-%s" % version)) + checks.extend(_load_deps_json("sugar-runtime-%s" % version)) + + return checks + +def _load_deps_json(name): + path = os.path.join(config_path, "%s.json" % name) + return json.load(open(path)) + |