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/distro.py32
-rw-r--r--devbot/system.py12
2 files changed, 24 insertions, 20 deletions
diff --git a/devbot/distro.py b/devbot/distro.py
index 06bffee..6bfc43c 100644
--- a/devbot/distro.py
+++ b/devbot/distro.py
@@ -2,11 +2,12 @@ import os
import subprocess
_package_managers = {}
-_distros_info = []
+_supported_distros = []
+_distro_info = None
def register_distro_info(distro_info):
- global _distros_info
- _distros_info.append(distro_info)
+ global _supported_distros
+ _supported_distros.append(distro_info)
def register_package_manager(name, package_manager):
global _package_managers
@@ -18,15 +19,30 @@ def get_package_manager(test=False, interactive=True):
return package_manager_class(test=test, interactive=interactive)
def get_distro_info():
- global _distros_info
+ global _supported_distros
+ global _distro_info
+
+ if _distro_info is not None:
+ return _distro_info
unknown_distro = None
- for info_class in _distros_info:
+ for info_class in _supported_distros:
info = info_class()
if info.name == "unknown":
unknown_distro = info
elif info.valid:
- return info
-
- return unknown_distro
+ _distro_info = info
+
+ if _distro_info is None:
+ _distro_info = unknown_distro
+
+ print "*********************************************************\n" \
+ "You are running an unsupported distribution. You might be\n" \
+ "able to make sugar work by installing or building \n" \
+ "packages but it certainly won't work out of the box.\n" \
+ "You are strongly encouraged to pick one of the supported \n" \
+ "distributions listed in the README.\n" \
+ "*********************************************************\n"
+
+ return _distro_info
diff --git a/devbot/system.py b/devbot/system.py
index 7b74104..26ca39f 100644
--- a/devbot/system.py
+++ b/devbot/system.py
@@ -121,16 +121,6 @@ def stop_xvfb(xvfb_proc, orig_display):
xvfb_proc.terminate()
-def warn_if_unsupported(distro_name):
- if distro_name == "unsupported":
- print "*********************************************************\n" \
- "You are running an unsupported distribution. You might be\n" \
- "able to make sugar work by installing or building \n" \
- "packages but it certainly won't work out of the box.\n" \
- "You are strongly encouraged to pick one of the supported \n" \
- "distributions listed in the README.\n" \
- "*********************************************************\n"
-
def remove_packages(package_manager, packages):
distro_name = distro.get_distro_info().name
@@ -178,8 +168,6 @@ def check(remove=False, update=False, test=False, interactive=True,
run_checks(package_manager, config.load_checks(), packages)
- warn_if_unsupported(distro_name)
-
stop_xvfb(xvfb_proc, orig_display)
if update: