Package flumotion :: Package component :: Package producers :: Module checks
[hide private]

Source Code for Module flumotion.component.producers.checks

  1  # -*- Mode: Python -*- 
  2  # vi:si:et:sw=4:sts=4:ts=4 
  3  # 
  4  # Flumotion - a streaming media server 
  5  # Copyright (C) 2004,2005,2006,2007 Fluendo, S.L. (www.fluendo.com). 
  6  # All rights reserved. 
  7   
  8  # This file may be distributed and/or modified under the terms of 
  9  # the GNU General Public License version 2 as published by 
 10  # the Free Software Foundation. 
 11  # This file is distributed without any warranty; without even the implied 
 12  # warranty of merchantability or fitness for a particular purpose. 
 13  # See "LICENSE.GPL" in the source distribution for more information. 
 14   
 15  # Licensees having purchased or holding a valid Flumotion Advanced 
 16  # Streaming Server license may use this file in accordance with the 
 17  # Flumotion Advanced Streaming Server Commercial License Agreement. 
 18  # See "LICENSE.Flumotion" in the source distribution for more information. 
 19   
 20  # Headers in this file shall remain intact. 
 21   
 22  from twisted.internet import defer 
 23   
 24  from flumotion.common import gstreamer, messages 
 25  from flumotion.common.i18n import N_, gettexter 
 26  from flumotion.worker.checks import check 
 27   
 28  __version__ = "$Rev: 6695 $" 
 29  T_ = gettexter() 
 30   
 31   
32 -def get_gst_version(gst):
33 if hasattr(gst, 'get_gst_version'): 34 return gst.get_gst_version() 35 elif hasattr(gst, 'version'): 36 return gst.version() 37 else: 38 return gst.gst_version + (0,)
39
40 -def get_pygst_version(gst):
41 if hasattr(gst, 'get_pygst_version'): 42 return gst.get_pygst_version() 43 else: 44 return gst.pygst_version + (0,)
45
46 -def checkTicket347():
47 """ 48 Check for a recent enough PyGTK to not leak python integers in message 49 processing (mostly affects soundcard, firewire) 50 """ 51 result = messages.Result() 52 import pygtk 53 pygtk.require('2.0') 54 import gobject 55 # Really, we want to check for pygobject_version, but that doesn't exist in 56 # all versions of pygtk, and this check is sufficient. 57 (major, minor, nano) = gobject.pygtk_version 58 if (major, minor, nano) < (2, 8, 6): 59 m = messages.Warning(T_( 60 N_("Version %d.%d.%d of the PyGTK library contains " 61 "a memory leak.\n"), 62 major, minor, nano), 63 mid='ticket-347') 64 m.add(T_(N_("The Soundcard and Firewire sources may leak a lot of " 65 "memory as a result, and need to be restarted frequently.\n"))) 66 m.add(T_(N_("Please upgrade '%s' to version %s or later."), 67 'pygtk', '2.8.6')) 68 result.add(m) 69 70 result.succeed(None) 71 return defer.succeed(result)
72
73 -def checkTicket348():
74 result = messages.Result() 75 import pygst 76 pygst.require('0.10') 77 import gst 78 (major, minor, nano) = gst.pygst_version 79 if (major, minor, nano) < (0, 10, 3): 80 m = messages.Warning(T_( 81 N_("Version %d.%d.%d of the gst-python library contains " 82 "a large memory leak.\n"), 83 major, minor, nano), 84 mid='ticket-348') 85 m.add(T_(N_("The Soundcard and Firewire sources may leak a lot of " 86 "memory as a result, and need to be restarted frequently.\n"))) 87 m.add(T_(N_("Please upgrade '%s' to version %s or later."), 88 'gst-python', '0.10.3')) 89 result.add(m) 90 91 result.succeed(None) 92 return defer.succeed(result)
93
94 -def checkTicket349():
95 result = messages.Result() 96 import pygst 97 pygst.require('0.10') 98 import gst 99 100 if get_gst_version(gst) < (0, 10, 4, 1): 101 major, minor, micro, nano = get_gst_version(gst) 102 m = messages.Error(T_( 103 N_("Version %d.%d.%d of the GStreamer library is too old.\n"), 104 major, minor, micro), 105 mid='ticket-349') 106 m.add(T_(N_("The '%s' component needs a newer version of '%s'.\n"), 107 'looper', 'gstreamer')) 108 m.add(T_(N_("Please upgrade '%s' to version %s or later."), 109 'gstreamer', '0.10.5')) 110 result.add(m) 111 112 if get_pygst_version(gst) < (0, 10, 3, 1): 113 major, minor, micro, nano = get_pygst_version(gst) 114 m = messages.Error(T_( 115 N_("Version %d.%d.%d of the gst-python library is too old.\n"), 116 major, minor, micro), 117 mid='ticket-349') 118 m.add(T_(N_("The '%s' component needs a newer version of '%s'.\n"), 119 'looper', 'gst-python')) 120 m.add(T_(N_("Please upgrade '%s' to version %s or later."), 121 'gst-python', '0.10.4')) 122 result.add(m) 123 124 result.succeed(None) 125 return defer.succeed(result)
126