thomasvs - in flumotion/trunk: . flumotion/worker/checks
flumotion-commit at lists.fluendo.com
flumotion-commit at lists.fluendo.com
Thu Mar 8 19:28:22 CET 2007
Author: thomasvs
Date: Thu Mar 8 19:28:19 2007
New Revision: 4609
Modified:
flumotion/trunk/ChangeLog
flumotion/trunk/flumotion/worker/checks/check.py
Log:
* flumotion/worker/checks/check.py:
add a generic checkPlugin method to be used in checks
Modified: flumotion/trunk/ChangeLog
==============================================================================
--- flumotion/trunk/ChangeLog (original)
+++ flumotion/trunk/ChangeLog Thu Mar 8 19:28:19 2007
@@ -1,5 +1,10 @@
2007-03-08 Thomas Vander Stichele <thomas at apestaart dot org>
+ * flumotion/worker/checks/check.py:
+ add a generic checkPlugin method to be used in checks
+
+2007-03-08 Thomas Vander Stichele <thomas at apestaart dot org>
+
* flumotion/component/component.py:
Checks are responsible for adding error messages to the component.
Fixes those pesky bogus component setup error messages without
Modified: flumotion/trunk/flumotion/worker/checks/check.py
==============================================================================
--- flumotion/trunk/flumotion/worker/checks/check.py (original)
+++ flumotion/trunk/flumotion/worker/checks/check.py Thu Mar 8 19:28:19 2007
@@ -21,7 +21,8 @@
import gst
-from flumotion.common import errors, log, messages
+from twisted.internet import defer
+from flumotion.common import errors, log, messages, gstreamer
from flumotion.common.messages import N_
T_ = messages.gettexter('flumotion')
@@ -124,3 +125,33 @@
def __init__(self, data):
self.data = data
+
+def checkPlugin(pluginName, packageName, minimumVersion=None):
+ """
+ Check if the given plug-in is available.
+ Return a result with an error if it is not, or not new enough.
+
+ @rtype: L{messages.Result}
+ """
+ result = messages.Result()
+ version = gstreamer.get_plugin_version(pluginName)
+ if not version:
+ m = messages.Error(T_(
+ N_("This host is missing the '%s' GStreamer plug-in.\n"),
+ pluginName))
+ m.add(T_(N_(
+ "Please install '%s'.\n"), packageName))
+ result.add(m)
+ else:
+ if version < minimumVersion:
+ m = messages.Error(T_(
+ N_("Version %s of the '%s' GStreamer plug-in is too old.\n"),
+ string.join([str(x) for x in version], '.'), pluginName),
+ id = 'plugin-%s-check' % pluginName)
+ m.add(T_(N_(
+ "Please upgrade '%s' to version %s."), packageName,
+ string.join([str(x) for x in minimumVersion], '.')))
+ result.add(m)
+
+ result.succeed(None)
+ return defer.succeed(result)
More information about the flumotion-commit
mailing list