wingo - in flumotion/trunk: . flumotion/component/combiners/switch
flumotion/worker/checks
flumotion-commit at lists.fluendo.com
flumotion-commit at lists.fluendo.com
Wed Dec 19 12:01:12 CET 2007
Author: wingo
Date: Wed Dec 19 12:01:04 2007
New Revision: 6018
Modified:
flumotion/trunk/ChangeLog
flumotion/trunk/flumotion/component/combiners/switch/patternswitch.py
flumotion/trunk/flumotion/component/combiners/switch/switch.py
flumotion/trunk/flumotion/worker/checks/check.py
Log:
2007-12-19 Andy Wingo <wingo at pobox.com>
* flumotion/component/combiners/switch/switch.py
(Switch.do_check): Check for a sufficiently new switch.
* flumotion/worker/checks/check.py (checkPlugin): Add crack to
allow user-defined checks to be run on particular plugin features.
* flumotion/component/combiners/switch/patternswitch.py
(PatternEventSwitcher._markers_event_probe): Minor fixes; this one
is still bitrotten. Not an AP tho.
Modified: flumotion/trunk/ChangeLog
==============================================================================
--- flumotion/trunk/ChangeLog (original)
+++ flumotion/trunk/ChangeLog Wed Dec 19 12:01:04 2007
@@ -1,3 +1,15 @@
+2007-12-19 Andy Wingo <wingo at pobox.com>
+
+ * flumotion/component/combiners/switch/switch.py
+ (Switch.do_check): Check for a sufficiently new switch.
+
+ * flumotion/worker/checks/check.py (checkPlugin): Add crack to
+ allow user-defined checks to be run on particular plugin features.
+
+ * flumotion/component/combiners/switch/patternswitch.py
+ (PatternEventSwitcher._markers_event_probe): Minor fixes; this one
+ is still bitrotten. Not an AP tho.
+
2007-12-18 Andy Wingo <wingo at pobox.com>
* flumotion/component/combiners/switch/basicwatchdog.py
Modified: flumotion/trunk/flumotion/component/combiners/switch/patternswitch.py
==============================================================================
--- flumotion/trunk/flumotion/component/combiners/switch/patternswitch.py (original)
+++ flumotion/trunk/flumotion/component/combiners/switch/patternswitch.py Wed Dec 19 12:01:04 2007
@@ -63,8 +63,8 @@
evt_struct = event.get_structure()
if evt_struct.get_name() == 'FluStreamMark':
if evt_struct['action'] == 'start':
- self.switch_to_for_event("backup", True)
+ self.switch_to("backup")
elif evt_struct['action'] == 'stop':
- self.switch_to_for_event("master", False)
+ self.switch_to("master")
return True
Modified: flumotion/trunk/flumotion/component/combiners/switch/switch.py
==============================================================================
--- flumotion/trunk/flumotion/component/combiners/switch/switch.py (original)
+++ flumotion/trunk/flumotion/component/combiners/switch/switch.py Wed Dec 19 12:01:04 2007
@@ -23,6 +23,7 @@
import sets
import gst
+import gobject
from twisted.internet import defer, reactor
@@ -125,13 +126,19 @@
self.state.remove('messages', m)
def do_check(self):
+ def checkSignal(fact):
+ fact = fact.load()
+ signals = gobject.signal_list_names(fact.get_element_type())
+ return 'block' in signals
+
def cb(result):
for m in result.messages:
self.addMessage(m)
return result.value
self.debug("checking for switch element")
- d = check.checkPlugin('switch', 'gst-plugins-bad', (0, 10, 5, 1))
+ d = check.checkPlugin('switch', 'gst-plugins-bad', (0, 10, 5, 2),
+ 'switch', checkSignal)
d.addCallback(cb)
return d
Modified: flumotion/trunk/flumotion/worker/checks/check.py
==============================================================================
--- flumotion/trunk/flumotion/worker/checks/check.py (original)
+++ flumotion/trunk/flumotion/worker/checks/check.py Wed Dec 19 12:01:04 2007
@@ -145,15 +145,27 @@
log.debug('check', 'checkElements: returning elements names %r', ret)
return ret
-def checkPlugin(pluginName, packageName, minimumVersion=None):
+def checkPlugin(pluginName, packageName, minimumVersion=None,
+ featureName=None, featureCheck=None):
"""
Check if the given plug-in is available.
Return a result with an error if it is not, or not new enough.
+ @param pluginName: name of the plugin to check
+ @param packageName: name of the package to tell the user to install
+ if the check fails
+ @param minimumVersion: minimum version of the plugin, as a tuple.
+ Optional.
+ @param featureName: name of a specific feature to check for in the
+ plugin. Optional. Overrides the minimum version check, if given.
+ @param featureCheck: function to call on the found feature, which
+ should return a boolean representing whether the feature is good or
+ not. Optional, and only makes sense if you specify featureName.
@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"),
@@ -161,16 +173,28 @@
m.add(T_(N_(
"Please install '%s'.\n"), packageName))
result.add(m)
- else:
- if version < minimumVersion:
+ elif featureName:
+ r = gst.registry_get_default()
+ features = r.get_feature_list_by_plugin(pluginName)
+ byname = dict([(f.get_name(), f) for f in features])
+ if (featureName not in byname
+ or (featureCheck and not featureCheck(byname[featureName]))):
m = messages.Error(T_(
- N_("Version %s of the '%s' GStreamer plug-in is too old.\n"),
- ".".join([str(x) for x in version]), pluginName),
+ N_("Your '%s' GStreamer plug-in is too old.\n"), pluginName),
id = 'plugin-%s-check' % pluginName)
m.add(T_(N_(
- "Please upgrade '%s' to version %s."), packageName,
- ".".join([str(x) for x in minimumVersion])))
+ "Please upgrade '%s' to version %s or development packages."),
+ packageName, ".".join([str(x) for x in minimumVersion])))
result.add(m)
+ elif version < minimumVersion:
+ m = messages.Error(T_(
+ N_("Version %s of the '%s' GStreamer plug-in is too old.\n"),
+ ".".join([str(x) for x in version]), pluginName),
+ id = 'plugin-%s-check' % pluginName)
+ m.add(T_(N_(
+ "Please upgrade '%s' to version %s."), packageName,
+ ".".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