Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
path: root/devbot
diff options
context:
space:
mode:
Diffstat (limited to 'devbot')
-rw-r--r--devbot/config.py10
-rw-r--r--devbot/plugins/debian.py2
-rw-r--r--devbot/plugins/fedora.py4
-rw-r--r--devbot/plugins/ubuntu.py27
4 files changed, 21 insertions, 22 deletions
diff --git a/devbot/config.py b/devbot/config.py
index a5f9428..4c04a56 100644
--- a/devbot/config.py
+++ b/devbot/config.py
@@ -233,7 +233,8 @@ def _filter_if(item):
return True
distro_info = distro.get_distro_info()
- globals = { "gstreamer_version": distro_info.gstreamer_version }
+ globals = { "gstreamer_version": distro_info.gstreamer_version,
+ "gnome_version": distro_info.gnome_version }
return eval(item["if"], globals)
@@ -248,15 +249,14 @@ def load_checks():
def load_modules():
module_dir = os.path.join(config_dir, "modules")
+ modules = []
with open(os.path.join(module_dir, "index.json")) as f:
- modules = []
for module_file in json.load(f):
path = os.path.join(module_dir, module_file)
-
for info in json.load(open(path)):
- modules.append(Module(info))
+ modules.append(info)
- return modules
+ return [Module(info) for info in filter(_filter_if, modules)]
def clean():
try:
diff --git a/devbot/plugins/debian.py b/devbot/plugins/debian.py
index 687ffad..eea0001 100644
--- a/devbot/plugins/debian.py
+++ b/devbot/plugins/debian.py
@@ -97,7 +97,7 @@ class DistroInfo(interfaces.DistroInfo):
self.use_lib64 = False
try:
- with open(_DEBIAN_VERSION_PATH) as f:
+ with open(self._DEBIAN_VERSION_PATH) as f:
debian_version = f.read()
except IOError:
debian_version = None
diff --git a/devbot/plugins/fedora.py b/devbot/plugins/fedora.py
index ebfc91a..27f1d17 100644
--- a/devbot/plugins/fedora.py
+++ b/devbot/plugins/fedora.py
@@ -96,11 +96,11 @@ class DistroInfo(interfaces.DistroInfo):
self.supported = (arch in ["i386", "i686", "x86_64"])
try:
- release = open(_FEDORA_RELEASE_PATH).read().strip()
+ release = open(self._FEDORA_RELEASE_PATH).read().strip()
except IOError:
release = None
self.valid = False
-
+
if release == "Fedora release 17 (Beefy Miracle)":
self.version = "17"
self.gnome_version = "3.4"
diff --git a/devbot/plugins/ubuntu.py b/devbot/plugins/ubuntu.py
index eaeb482..47379ac 100644
--- a/devbot/plugins/ubuntu.py
+++ b/devbot/plugins/ubuntu.py
@@ -7,6 +7,7 @@ from devbot.plugins import debian
distro.register_package_manager("ubuntu", debian.PackageManager)
class DistroInfo(interfaces.DistroInfo):
+ _OS_RELEASE_PATH="/etc/os-release"
def __init__(self):
arch = subprocess.check_output(["uname", "-i"]).strip()
@@ -17,11 +18,21 @@ class DistroInfo(interfaces.DistroInfo):
self.valid = True
self.supported = (arch in ["i386", "i686", "x86_64"])
self.use_lib64 = False
+
+ try:
+ release = open(self._OS_RELEASE_PATH).read().strip()
+ os_info = {}
+ for line in release.split("\n"):
+ split = line.strip().split("=")
+ os_info[split[0]] = split[1].replace("\"", "")
+ except IOError:
+ release = None
+ self.valid = False
- if self._get_distributor() != "Ubuntu":
+ if os_info["ID"] != "ubuntu":
self.valid = False
- self.version = self._get_release()
+ self.version = os_info.get("VERSION_ID", None)
if self.version != "12.10":
self.supported = False
@@ -29,16 +40,4 @@ class DistroInfo(interfaces.DistroInfo):
if self.version and self.version >= "12.10":
self.gnome_version = "3.6"
- def _get_distributor(self):
- try:
- return subprocess.check_output(["lsb_release", "-si"]).strip()
- except OSError:
- None
-
- def _get_release(self):
- try:
- return subprocess.check_output(["lsb_release", "-sr"]).strip()
- except OSError:
- return None
-
distro.register_distro_info(DistroInfo)