From 66dc2e7ea7011ae63e1d404ebffeaa7782a7f2f5 Mon Sep 17 00:00:00 2001 From: Daniel Narvaez Date: Wed, 14 Nov 2012 15:32:49 +0000 Subject: 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. --- (limited to 'devbot/config.py') 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)) + -- cgit v0.9.1