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: 8057 $" 
 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
41 -def get_pygst_version(gst):
42 if hasattr(gst, 'get_pygst_version'): 43 return gst.get_pygst_version() 44 else: 45 return gst.pygst_version + (0, )
46 47
48 -def checkTicket347():
49 """ 50 Check for a recent enough PyGTK to not leak python integers in message 51 processing (mostly affects soundcard, firewire) 52 """ 53 result = messages.Result() 54 import pygtk 55 pygtk.require('2.0') 56 import gobject 57 # Really, we want to check for pygobject_version, but that doesn't exist in 58 # all versions of pygtk, and this check is sufficient. 59 (major, minor, nano) = gobject.pygtk_version 60 if (major, minor, nano) < (2, 8, 6): 61 m = messages.Warning(T_( 62 N_("Version %d.%d.%d of the PyGTK library contains " 63 "a memory leak.\n"), 64 major, minor, nano), 65 mid='ticket-347') 66 m.add(T_(N_("The Soundcard and Firewire sources may leak a lot of " 67 "memory as a result, and would need to be restarted " 68 "frequently.\n"))) 69 m.add(T_(N_("Please upgrade '%s' to version %s or later."), 70 'pygtk', '2.8.6')) 71 result.add(m) 72 73 result.succeed(None) 74 return defer.succeed(result)
75 76
77 -def checkTicket348():
78 result = messages.Result() 79 import pygst 80 pygst.require('0.10') 81 import gst 82 (major, minor, nano) = gst.pygst_version 83 if (major, minor, nano) < (0, 10, 3): 84 m = messages.Warning(T_( 85 N_("Version %d.%d.%d of the gst-python library contains " 86 "a large memory leak.\n"), 87 major, minor, nano), 88 mid='ticket-348') 89 m.add(T_(N_("The Soundcard and Firewire sources may leak a lot of " 90 "memory as a result, and need to be restarted frequently.\n"))) 91 m.add(T_(N_("Please upgrade '%s' to version %s or later."), 92 'gst-python', '0.10.3')) 93 result.add(m) 94 95 result.succeed(None) 96 return defer.succeed(result)
97 98
99 -def checkTicket349():
100 result = messages.Result() 101 import pygst 102 pygst.require('0.10') 103 import gst 104 105 if get_gst_version(gst) < (0, 10, 4, 1): 106 major, minor, micro, nano = get_gst_version(gst) 107 m = messages.Error(T_( 108 N_("Version %d.%d.%d of the GStreamer library is too old.\n"), 109 major, minor, micro), 110 mid='ticket-349') 111 m.add(T_(N_("The '%s' component needs a newer version of '%s'.\n"), 112 'looper', 'gstreamer')) 113 m.add(T_(N_("Please upgrade '%s' to version %s or later."), 114 'gstreamer', '0.10.5')) 115 result.add(m) 116 117 if get_pygst_version(gst) < (0, 10, 3, 1): 118 major, minor, micro, nano = get_pygst_version(gst) 119 m = messages.Error(T_( 120 N_("Version %d.%d.%d of the gst-python library is too old.\n"), 121 major, minor, micro), 122 mid='ticket-349') 123 m.add(T_(N_("The '%s' component needs a newer version of '%s'.\n"), 124 'looper', 'gst-python')) 125 m.add(T_(N_("Please upgrade '%s' to version %s or later."), 126 'gst-python', '0.10.4')) 127 result.add(m) 128 129 result.succeed(None) 130 return defer.succeed(result)
131