Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--devbot/plugins/debian.py5
-rw-r--r--devbot/plugins/fedora.py5
-rw-r--r--devbot/plugins/ubuntu.py5
-rw-r--r--tests/devbot/test_config.py12
4 files changed, 24 insertions, 3 deletions
diff --git a/devbot/plugins/debian.py b/devbot/plugins/debian.py
index eea0001..856a7f7 100644
--- a/devbot/plugins/debian.py
+++ b/devbot/plugins/debian.py
@@ -86,7 +86,7 @@ distro.register_package_manager("debian", PackageManager)
class DistroInfo(interfaces.DistroInfo):
_DEBIAN_VERSION_PATH = "/etc/debian_version"
def __init__(self):
- arch = subprocess.check_output(["arch"]).strip()
+ arch = self._get_architecture()
self.name = "debian"
self.version = "unknown"
@@ -110,4 +110,7 @@ class DistroInfo(interfaces.DistroInfo):
else:
self.supported = False
+ def _get_architecture(self):
+ return subprocess.check_output(["arch"]).strip()
+
distro.register_distro_info(DistroInfo)
diff --git a/devbot/plugins/fedora.py b/devbot/plugins/fedora.py
index 27f1d17..862ca81 100644
--- a/devbot/plugins/fedora.py
+++ b/devbot/plugins/fedora.py
@@ -85,7 +85,7 @@ class DistroInfo(interfaces.DistroInfo):
_FEDORA_RELEASE_PATH = "/etc/fedora-release"
def __init__(self):
- arch = subprocess.check_output(["uname", "-i"]).strip()
+ arch = self._get_architecture()
self.name = "fedora"
self.version = "unknown"
@@ -110,4 +110,7 @@ class DistroInfo(interfaces.DistroInfo):
else:
self.supported = False
+ def _get_architecture(self):
+ return subprocess.check_output(["uname", "-i"]).strip()
+
distro.register_distro_info(DistroInfo)
diff --git a/devbot/plugins/ubuntu.py b/devbot/plugins/ubuntu.py
index 47379ac..140d8ad 100644
--- a/devbot/plugins/ubuntu.py
+++ b/devbot/plugins/ubuntu.py
@@ -9,7 +9,7 @@ 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()
+ arch = self._get_architecture()
self.name = "ubuntu"
self.version = "unknown"
@@ -40,4 +40,7 @@ class DistroInfo(interfaces.DistroInfo):
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)
diff --git a/tests/devbot/test_config.py b/tests/devbot/test_config.py
index 39b3f65..dcb5511 100644
--- a/tests/devbot/test_config.py
+++ b/tests/devbot/test_config.py
@@ -32,6 +32,11 @@ class TestConfig(unittest.TestCase):
info_class._OS_RELEASE_PATH = \
os.path.join(data_dir, "os-release-ubuntu-12.10")
+ def _get_architecture(self):
+ return "x86_64"
+
+ info_class._get_architecture = _get_architecture
+
for info_class in distro._supported_distros:
info = info_class()
if info.name == name and info.version == version:
@@ -39,6 +44,8 @@ class TestConfig(unittest.TestCase):
distro._distro_info = None
break
+ self._check_distro_info()
+
def _unset_distro(self):
distro._supported_distros = self._orig
@@ -55,6 +62,11 @@ class TestConfig(unittest.TestCase):
def _assert_no_module(self, modules, name):
self.assertIsNone(self._find_module(modules, name))
+ def _check_distro_info(self):
+ distro_info = distro.get_distro_info()
+ self.assertTrue(distro_info.supported)
+ self.assertTrue(distro_info.valid)
+
def test_fedora_17_modules(self):
self._set_distro("fedora", "17")