Package Biskit :: Package Dock :: Module settings
[hide private]
[frames] | no frames]

Source Code for Module Biskit.Dock.settings

  1  ## 
  2  ## Biskit, a toolkit for the manipulation of macromolecular structures 
  3  ## Copyright (C) 2004-2006 Raik Gruenberg & Johan Leckner 
  4  ## 
  5  ## This program is free software; you can redistribute it and/or 
  6  ## modify it under the terms of the GNU General Public License as 
  7  ## published by the Free Software Foundation; either version 2 of the 
  8  ## License, or any later version. 
  9  ## 
 10  ## This program is distributed in the hope that it will be useful, 
 11  ## but WITHOUT ANY WARRANTY; without even the implied warranty of 
 12  ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 
 13  ## General Public License for more details. 
 14  ## 
 15  ## You find a copy of the GNU General Public License in the file 
 16  ## license.txt along with this program; if not, write to the Free 
 17  ## Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 
 18  ## 
 19  ## 
 20  ## last $Author: graik $ 
 21  ## last $Date: 2007/02/28 22:37:33 $ 
 22  ## $Revision: 2.6 $ 
 23   
 24  """ 
 25  Settings 
 26  ======== 
 27   
 28  This module provides Dock-global settings as fields. Throughout 
 29  Biskit.Dock a (environment-dependent) parameter such as, e.g., ssh_bin 
 30  can be addressed as: 
 31   
 32    >>> import Biskit.Dock.settings as S 
 33    >>> bin = S.ssh_bin 
 34   
 35  However, since a user should not be required to hack python modules, 
 36  ssh_bin is not actually defined in settings.py. Instead, the value is 
 37  taken from C{~/.biskit/settings_Dock.cfg} -- which should have an entry 
 38  like C{ssh_bin=/bin/ssh # comment}. If this entry (or the config file) 
 39  is not found, settings.py uses the default value from 
 40  C{biskit/external/defaults/settings_Dock.cfg}. 
 41   
 42  If missing, the user configuration file C{~/.biskit/settings_Dock.cfg} is 
 43  created automatically during the startup of Biskit (i.e. for any 
 44  import). The auto-generated file only contains parameters for which 
 45  the default values don't seem to work (invalid paths or binaries). 
 46   
 47  See L{Biskit.SettingsManager} 
 48   
 49  Summary for Biskit users 
 50  ------------------------ 
 51    If you want to change a biskit parameter, do so in 
 52    C{~/.biskit/settings_Dock.cfg} 
 53   
 54  Summary for Biskit developpers 
 55  ------------------------------ 
 56    If you want to create a new user-adjustable parameter, do so in 
 57    C{biskit/external/defaults/settings_Dock.cfg}. 
 58   
 59  Summary for all 
 60  --------------- 
 61    !Dont't touch C{settings.py}! 
 62  """ 
 63  import Biskit as B 
 64  import Biskit.tools as T 
 65  import Biskit.SettingsManager as M 
 66   
 67  import user, sys 
 68   
 69  __CFG_DEFAULT = T.projectRoot() + '/external/defaults/settings_Dock.cfg' 
 70  __CFG_USER    = user.home + '/.biskit/settings_Dock.cfg' 
 71   
 72  try: 
 73      m = M.SettingsManager(__CFG_DEFAULT, __CFG_USER, createmissing=True  ) 
 74   
 75      m.updateNamespace( locals() ) 
 76   
 77  except Exception, why: 
 78      B.EHandler.fatal( 'Error importing Biskit.Dock settings') 
 79   
 80   
 81  ############################## 
 82  ## Check environment variables 
 83  env = {} 
 84   
 85  hex_env = {'HEX_ROOT':'/home/Bis/johan/APPLICATIONS/HEX', 
 86             'HEX_CACHE':'/home/Bis/johan/APPLICATIONS/HEX/hex_cache', 
 87             'HEX_VERSION':'4b'} 
 88   
 89  prosaII_env = {'PROSA_BASE':'/home/Bis/shared/rh73/prosa/prosabase/'} 
 90   
 91  env.update(hex_env) 
 92  env.update(prosaII_env) 
 93   
 94  ###################### 
 95  ## clean up name space 
 96   
 97  del B, T, M, user, sys 
 98  del __CFG_DEFAULT, __CFG_USER, m 
 99   
100  ################ 
101  ## empty test ## 
102  import Biskit.test as BT 
103   
104 -class Test(BT.BiskitTest):
105 """Mock test, settings is always executed anyway.""" 106 pass
107