Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
path: root/devbot/plugins/ubuntu.py
blob: 005871c0071036182fe98cc65fc39aba14708289 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
import subprocess

from devbot import distro
from devbot.plugins import interfaces
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 = self._get_architecture()
 
        self.name = "ubuntu"
        self.version = "unknown"
        self.gnome_version = "3.4"
        self.gstreamer_version = "1.0"
        self.valid = True
        self.supported = (arch in ["i386", "i686", "x86_64"])
        self.lib_dir = None

        if arch in ["i386", "i686"]:
            self.lib_dir = "lib/i386-linux-gnu"
        elif arch == "x86_64":
            self.lib_dir = "lib/x86_64-linux-gnu"

        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 os_info["ID"] != "ubuntu":
            self.valid = False
       
        self.version = os_info.get("VERSION_ID", None)

        if self.version != "12.10":
            self.supported = False

        if self.version and self.version >= "12.10":
            self.gnome_version = "3.6"

    def _get_architecture(self):
        return subprocess.check_output(["uname", "-i"]).strip() 

distro.register_distro_info(DistroInfo)