Package flumotion :: Package configure :: Module configure
[hide private]

Source Code for Module flumotion.configure.configure

  1  # -*- Mode: Python; test-case-name: flumotion.test.test_configure -*- 
  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  ''' 
 23  configure-time variables for installed or uninstalled operation 
 24   
 25  Code should run 
 26      >>> from flumotion.configure import configure 
 27   
 28  and then access the variables from the configure module.  For example: 
 29      >>> print configure.gladedir 
 30   
 31  The values are decided at ./configure time.  They can be overridden at startup 
 32  by programs based on environment or options.  This allows running with 
 33  different configdir, logdir and rundir. 
 34   
 35  @var  isinstalled: whether an installed version is being run 
 36  @type isinstalled: boolean 
 37   
 38  @var  cachedir:      directory where cached code is stored 
 39  @type cachedir:      string 
 40  @var  configdir:     directory where configuration files are stored 
 41  @type configdir:     string 
 42  @var  daemondir:     directory where daemonized programs should run 
 43  @type daemondir:     string 
 44  @var  datadir:       directory where data files are stored 
 45  @type datadir:       string 
 46  @var  gladedir:      directory where glade files are stored 
 47  @type gladedir:      string 
 48  @var  logdir:        directory where log files are stored 
 49  @type logdir:        string 
 50  @var  imagedir:      directory where image files are stored 
 51  @type imagedir:      string 
 52  @var  pythondir:     directory where the flumotion python files are stored 
 53  @type pythondir:     string 
 54  @var  registrydir:   directory where the registry files are stored 
 55  @type registrydir:   string 
 56  @var  rundir:        directory where the run/pid files are stored 
 57  @type rundir:        string 
 58  @var  bindir:        directory where the flumotion executables live 
 59  @type bindir:        string 
 60  @var  sbindir:       directory where the flumotion service program lives 
 61  @type sbindir:       string 
 62   
 63  @var  defaultTCPManagerPort:  the default manager port for TCP communication 
 64  @type defaultTCPManagerPort:  int 
 65  @var  defaultSSLManagerPort:  the default manager port for SSL communication 
 66  @type defaultSSLManagerPort:  int 
 67  @var  defaultStreamPortRange: the default range of external streaming ports 
 68  @type defaultStreamPortRange: list of ints 
 69  @var  defaultGstPortRange:    the default range of internal GStreamer ports 
 70  @type defaultGstPortRange:    list of ints 
 71   
 72  @var  version:      Flumotion version number 
 73  @type version:      string 
 74  @var  versionTuple: Flumotion version number 
 75  @type versionTuple: 4-tuple of integers 
 76  ''' 
 77   
 78  # Note: This module is loaded very early on, so 
 79  #       don't add any extra flumotion imports unless you 
 80  #       really know what you're doing 
 81   
 82  # FIXME: document all the module variables 
 83   
 84  import os 
 85   
 86  # where am I on the disk ? 
 87  __thisdir = os.path.dirname(os.path.abspath(__file__)) 
 88   
 89  if os.path.exists(os.path.join(__thisdir, 'uninstalled.py')): 
 90      from flumotion.configure import uninstalled 
 91      _config = uninstalled.get() 
 92  else: 
 93      from flumotion.configure import installed 
 94      _config = installed.get() 
 95   
 96  # default values for ports 
 97  _config['defaultTCPManagerPort'] = 8642 
 98  _config['defaultSSLManagerPort'] = 7531 
 99  _config['defaultStreamPortRange'] = range(8800, 8844 + 1) 
100  _config['defaultGstPortRange'] = range(8600, 8639 + 1) 
101   
102  # default values for service-related stuff 
103  # how long to wait before timing out term and kill signals 
104  _config['processTermWait'] = 5 
105  _config['processKillWait'] = 5 
106   
107  # default value for component heartbeat interval, in seconds 
108  _config['heartbeatInterval'] = 5 
109   
110 -def _versionStringToTuple(versionString):
111 t = tuple(map(int, versionString.split('.'))) 112 if len (t) < 4: 113 t = t + (0,) 114 return t
115 _config['versionTuple'] = _versionStringToTuple(_config['version']) 116 117 for key, value in _config.items(): 118 dictionary = locals() 119 dictionary[key] = value 120