RDConfig

Module RDConfig |
[hide private]
[frames] | no frames]

# Source Code for Module RDConfig

      1  #  $Id: RDConfig.py 332 2007-09-18 05:12:24Z glandrum $
      2  #
      3  #  Copyright (C) 2000-2006 Rational Discovery LLC
      4  #
      5  #   @@ All Rights Reserved  @@
      6  #
      7  """ Configuration for Rational Discovery's Python code
      8
      9  """
     10
     11  import os,sys
     12  try:
     13    RDBaseDir=os.environ['RDBASE']
     14  except:
     15    RDBaseDir='d:/RD'
     16  RDCodeDir=os.path.join(RDBaseDir,'Python')
     17  RDImageDir=os.path.join(RDCodeDir,'qtGui','Images')  # images used within the GUI tools
     18  RDDataDir=os.path.join(RDBaseDir,'Data')
     19  RDDocsDir=os.path.join(RDBaseDir,'Docs')
     20  RDDemoDir=os.path.join(RDBaseDir,'Demo')
     21  RDBinDir=os.path.join(RDBaseDir,'bin')
     22  RDProjDir=os.path.join(RDBaseDir,'Projects')
     23  #if not os.environ.has_key('OE_DIR') or os.environ['OE_DIR']=='':
     24  #  os.environ['OE_DIR'] = RDDataDir
     25
     26
     27  if os.environ.has_key('RDDGEOM'):
     28    dgeomLoc=os.environ['RDDGEOM']
     29  else:
     30    if sys.platform=='win32':
     31      binName = 'dgeom.exe'
     32    else:
     33      binName = 'dgeom'
     34    dgeomLoc=os.path.join(RDBinDir,binName)
     35
     36  if os.environ.has_key('RDTINKER'):
     37    tinkerPath=os.environ['RDTINKER']
     38  else:
     39    if sys.platform=='win32':
     40      tinkerPath = ''
     41    else:
     42      tinkerPath = '/usr/local/src/tinker'
     43  tinkerBin = '%s/bin'%(tinkerPath)
     44  tinkerParams = '%s/params'%(tinkerPath)
     45
     46  try:
     47    doingDemo=os.environ['RDDEMO']
     48    if doingDemo=='0': doingDemo=0
     49  except:
     50    doingDemo=0
     51
     52  try:
     53    largeFont=os.environ['RDLARGEFONT']
     54  except:
     55    largeFont=0
     56
     57  RDFont=None
     58  logGui=0
     59
     60  rpcTestPort=8423
     61  pythonTestCommand="python"
     62
     63  defaultDBUser='sysdba'
     64  defaultDBPassword='masterkey'
     65
     66
     67  import exceptions
     68 -class ObsoleteCodeError(exceptions.Exception):
     69    pass
     70 -class UnimplementedCodeError(exceptions.Exception):
     71    pass
     72
     73  # ---------------------
     74  # the following block contains stuff used by the
     75  # testing infrastructure
     76  if sys.platform=='win32':
     77    pythonExe=os.path.join(os.environ.get('PYTHONHOME','c:/python23'),'python.exe')
     78    spawn = os.spawnve
     79  else:
     80    pythonExe="python"
     81    spawn = os.spawnvpe
     82
     83  # ---------------------
     84  # the following block contains stuff controlling database access:
     85  #usePgSQL=1
     86  usePgSQL=0
     87  useSqlLite=0
     88  if not (os.environ.has_key('RD_USEGVIB') and os.environ['RD_USEGVIB']):
     89    if not os.environ.get('RD_USESQLLITE',''):
     90      try:
     91        from pyPgSQL import PgSQL
     92        usePgSQL=1
     93      except ImportError:
     94        usePgSQL=0
     95        try:
     96          # python2.5 has this:
     97          import sqlite3
     98          useSqlLite=True
     99        except ImportError:
    100          try:
    101            # earlier versions of python:
    102            from pysqlite2 import dbapi2
    103            useSqlLite=True
    104          except:
    105            pass
    106    else:
    107      useSqlLite=True
    108  else:
    109    usePgSQL=0
    110
    111  if usePgSQL:
    112    RDTestDatabase='::RDTests'
    113    RDDataDatabase='::RDData'
    114  elif useSqlLite:
    115    RDTestDatabase=os.path.join(RDDataDir,"RDTests.sqlt")
    116    RDDataDatabase=os.path.join(RDDataDir,"RDData.sqlt")
    117  else:
    118    RDTestDatabase=os.path.join(RDDataDir,"RDTests.gdb")
    119    RDDataDatabase=os.path.join(RDDataDir,"RDData.gdb")
    120
    121  # ---------------------
    122  # the following block contains stuff controlling the program used for
    123  #  3D molecular visualization:
    124  molViewer=os.environ.get('RD_MOLVIEWER','PYMOL').upper()
    125