Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
path: root/devbot/plugins/ubuntu.py
diff options
context:
space:
mode:
authorDaniel Narvaez <dwnarvaez@gmail.com>2012-11-30 15:18:38 (GMT)
committer Daniel Narvaez <dwnarvaez@gmail.com>2012-11-30 15:18:38 (GMT)
commit4f98fe10ea482fad3fffe9d655d26139dea30965 (patch)
tree4a780e780e20177e17a7c2f97477ed578f7af49b /devbot/plugins/ubuntu.py
parentf87c98e40b1ae61b889abe06db944b88433c0ada (diff)
Add more tests and fix bugs
Diffstat (limited to 'devbot/plugins/ubuntu.py')
-rw-r--r--devbot/plugins/ubuntu.py27
1 files changed, 13 insertions, 14 deletions
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)