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:      stringed 
 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  defaultHTTPStreamPort:  the default external http streaming port 
 68  @type defaultHTTPStreamPort:  int 
 69  @var  defaultGstPortRange:    the default range of internal GStreamer ports 
 70  @type defaultGstPortRange:    list of ints 
 71   
 72  @var  PACKAGE:      Flumotion package 
 73  @type PACKAGE:      string 
 74  @var  version:      Flumotion version number 
 75  @type version:      string 
 76  @var  versionTuple: Flumotion version number 
 77  @type versionTuple: 4-tuple of integers 
 78  @var  branchName:   Flumotion branch name 
 79  @type branchName:   string 
 80   
 81  # default values for service-related stuff 
 82   
 83  @var  processTermWait: how long to wait before timing out term signals 
 84  @type processTermWait int 
 85  @var  processKillWait: how long to wait before timing out kill signals 
 86  @type processKillWait int 
 87  @var  heartbeatInterval: component heartbeat interval, in seconds 
 88  @type heartbeatInterval: int 
 89  ''' 
 90   
 91  # Note: This module is loaded very early on, so 
 92  #       don't add any extra flumotion imports unless you 
 93  #       really know what you're doing 
 94   
 95  import os 
 96   
 97  __version__ = "$Rev: 7081 $" 
 98   
 99  # where am I on the disk ? 
100  __thisdir = os.path.dirname(os.path.abspath(__file__)) 
101   
102  if os.path.exists(os.path.join(__thisdir, 'uninstalled.py')): 
103      from flumotion.configure import uninstalled 
104      _config = uninstalled.get() 
105  else: 
106      from flumotion.configure import installed 
107      _config = installed.get() 
108   
109 -def _versionStringToTuple(versionString):
110 t = tuple(map(int, versionString.split('.'))) 111 if len(t) < 4: 112 t = t + (0,) 113 return t
114 115 isinstalled = _config['isinstalled'] 116 117 cachedir = _config['cachedir'] 118 configdir = _config['configdir'] 119 daemondir = _config['daemondir'] 120 datadir = _config['datadir'] 121 gladedir = _config['gladedir'] 122 imagedir = _config['imagedir'] 123 logdir = _config['logdir'] 124 localedatadir = _config['localedatadir'] 125 pythondir = _config['pythondir'] 126 registrydir = _config['registrydir'] 127 rundir = _config['rundir'] 128 bindir = _config['bindir'] 129 sbindir = _config['sbindir'] 130 131 defaultTCPManagerPort = 8642 132 defaultSSLManagerPort = 7531 133 defaultHTTPStreamPort = 8800 134 defaultGstPortRange = range(8600, 8639 + 1) 135 136 PACKAGE = 'flumotion' 137 version = _config['version'] 138 versionTuple = _versionStringToTuple(version) 139 branchName = 'trunk' 140 141 processTermWait = 10 142 processKillWait = 5 143 heartbeatInterval = 5 144