RDConfig

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

# Source Code for Module RDConfig

     1  #  $Id$
     2  #
     3  #  Copyright (C) 2000-2010 Rational Discovery LLC
     4  #
     5  #   @@ All Rights Reserved @@
     6  #  This file is part of the RDKit.
     7  #  The contents are covered by the terms of the BSD license
     8  #  which is included in the file license.txt, found at the root
     9  #  of the RDKit source tree.
    10  #
    11  """ Configuration for the RDKit Python code
    12
    13  """
    14
    15  import os,sys
    16  if 'RDBASE' in os.environ:
    17    RDBaseDir=os.environ['RDBASE']
    18    RDCodeDir=os.path.join(RDBaseDir,'rdkit')
    19    RDDataDir=os.path.join(RDBaseDir,'Data')
    20    RDDocsDir=os.path.join(RDBaseDir,'Docs')
    21    RDDemoDir=os.path.join(RDBaseDir,'Demo')
    22    RDBinDir=os.path.join(RDBaseDir,'bin')
    23    RDProjDir=os.path.join(RDBaseDir,'Projects')
    24  elif 'CONDA_DEFAULT_ENV' in os.environ:
    25    # we are running in a conda environ.
    26    RDCodeDir=os.path.dirname(__file__)
    27    splitdir = RDCodeDir.split(os.path.sep)
    28    condaDir = splitdir[:-4]
    29    if condaDir[0]=='':
    30      condaDir[0] = os.path.sep
    31    condaDir += ['share','RDKit']
    32    _share = os.path.join(*condaDir)
    33    RDDataDir=os.path.join(_share,'Data')
    34    RDDocsDir=os.path.join(_share,'Docs')
    35    RDProjDir=os.path.join(_share,'Projects')
    36  else:
    37    from rdkit.RDPaths import *
    38
    39
    40  rpcTestPort=8423
    41  pythonTestCommand="python"
    42
    43  defaultDBUser='sysdba'
    44  defaultDBPassword='masterkey'
    45
    46 -class ObsoleteCodeError(Exception):
    47    pass
    48 -class UnimplementedCodeError(Exception):
    49    pass
    50
    51  # ---------------------
    52  # the following block contains stuff used by the
    53  # testing infrastructure
    54  if sys.platform=='win32':
    55    pythonExe=sys.executable
    56  else:
    57    pythonExe="python"
    58
    59  # ---------------------
    60  # the following block contains stuff controlling database access:
    61  usePgSQL=False
    62  useSqlLite=False
    63  if not os.environ.get('RD_USESQLLITE',''):
    64    try:
    65      from pyPgSQL import PgSQL
    66      usePgSQL=True
    67    except ImportError:
    68      usePgSQL=False
    69  if not usePgSQL:
    70    try:
    71      # python2.5 has this:
    72      import sqlite3
    73      useSqlLite=True
    74    except ImportError:
    75      try:
    76        # earlier versions of python:
    77        from pysqlite2 import dbapi2
    78        useSqlLite=True
    79      except ImportError:
    80        pass
    81
    82  if usePgSQL:
    83    RDTestDatabase='::RDTests'
    84    RDDataDatabase='::RDData'
    85  elif useSqlLite:
    86    RDTestDatabase=os.path.join(RDDataDir,"RDTests.sqlt")
    87    RDDataDatabase=os.path.join(RDDataDir,"RDData.sqlt")
    88  else:
    89    RDTestDatabase=None
    90    RDDataDatabase=None
    91
    92  # ---------------------
    93  # the following block contains stuff controlling the program used for
    94  #  3D molecular visualization:
    95  molViewer=os.environ.get('RD_MOLVIEWER','PYMOL').upper()
    96