File: RDConfig.py

package info (click to toggle)
rdkit 202009.4-1
  • links: PTS, VCS
  • area: main
  • in suites: bullseye
  • size: 129,624 kB
  • sloc: cpp: 288,030; python: 75,571; java: 6,999; ansic: 5,481; sql: 1,968; yacc: 1,842; lex: 1,254; makefile: 572; javascript: 461; xml: 229; fortran: 183; sh: 134; cs: 93
file content (86 lines) | stat: -rw-r--r-- 2,146 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
#  $Id$
#
#  Copyright (C) 2000-2010 Rational Discovery LLC
#
#   @@ All Rights Reserved @@
#  This file is part of the RDKit.
#  The contents are covered by the terms of the BSD license
#  which is included in the file license.txt, found at the root
#  of the RDKit source tree.
#
""" Configuration for the RDKit Python code

"""

import os, sys
if 'RDBASE' in os.environ:
  RDBaseDir = os.environ['RDBASE']
  RDCodeDir = os.path.join(RDBaseDir, 'rdkit')
  RDDataDir = os.path.join(RDBaseDir, 'Data')
  RDDocsDir = os.path.join(RDBaseDir, 'Docs')
  RDDemoDir = os.path.join(RDBaseDir, 'Demo')
  RDBinDir = os.path.join(RDBaseDir, 'bin')
  RDProjDir = os.path.join(RDBaseDir, 'Projects')
  RDContribDir = os.path.join(RDBaseDir, 'Contrib')
else:
  from rdkit.RDPaths import *
  import rdkit.RDPaths
  os.environ['RDBASE'] = rdkit.RDPaths._share

rpcTestPort = 8423
pythonTestCommand = "python"

defaultDBUser = 'sysdba'
defaultDBPassword = 'masterkey'


class ObsoleteCodeError(Exception):
  pass


class UnimplementedCodeError(Exception):
  pass


# ---------------------
# the following block contains stuff used by the
# testing infrastructure
pythonExe = sys.executable

# ---------------------
# the following block contains stuff controlling database access:
usePgSQL = False
useSqlLite = False
if not os.environ.get('RD_USESQLLITE', ''):
  try:
    from pyPgSQL import PgSQL
    usePgSQL = True
  except ImportError:
    usePgSQL = False
if not usePgSQL:
  try:
    # python2.5 has this:
    import sqlite3
    useSqlLite = True
  except ImportError:
    try:
      # earlier versions of python:
      from pysqlite2 import dbapi2
      useSqlLite = True
    except ImportError:
      pass

if usePgSQL:
  RDTestDatabase = '::RDTests'
  RDDataDatabase = '::RDData'
elif useSqlLite:
  RDTestDatabase = os.path.join(RDDataDir, "RDTests.sqlt")
  RDDataDatabase = os.path.join(RDDataDir, "RDData.sqlt")
else:
  RDTestDatabase = None
  RDDataDatabase = None

# ---------------------
# the following block contains stuff controlling the program used for
#  3D molecular visualization:
molViewer = os.environ.get('RD_MOLVIEWER', 'PYMOL').upper()