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 15import os, sys 16if '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 RDContribDir = os.path.join(RDBaseDir, 'Contrib') 25else: 26 from rdkit.RDPaths import * 27 import rdkit.RDPaths 28 os.environ['RDBASE'] = rdkit.RDPaths._share 29 30rpcTestPort = 8423 31pythonTestCommand = "python" 32 33defaultDBUser = 'sysdba' 34defaultDBPassword = 'masterkey' 35 36 37class ObsoleteCodeError(Exception): 38 pass 39 40 41class UnimplementedCodeError(Exception): 42 pass 43 44 45# --------------------- 46# the following block contains stuff used by the 47# testing infrastructure 48pythonExe = sys.executable 49 50# --------------------- 51# the following block contains stuff controlling database access: 52usePgSQL = False 53useSqlLite = False 54if not os.environ.get('RD_USESQLLITE', ''): 55 try: 56 from pyPgSQL import PgSQL 57 usePgSQL = True 58 except ImportError: 59 usePgSQL = False 60if not usePgSQL: 61 try: 62 # python2.5 has this: 63 import sqlite3 64 useSqlLite = True 65 except ImportError: 66 try: 67 # earlier versions of python: 68 from pysqlite2 import dbapi2 69 useSqlLite = True 70 except ImportError: 71 pass 72 73if usePgSQL: 74 RDTestDatabase = '::RDTests' 75 RDDataDatabase = '::RDData' 76elif useSqlLite: 77 RDTestDatabase = os.path.join(RDDataDir, "RDTests.sqlt") 78 RDDataDatabase = os.path.join(RDDataDir, "RDData.sqlt") 79else: 80 RDTestDatabase = None 81 RDDataDatabase = None 82 83# --------------------- 84# the following block contains stuff controlling the program used for 85# 3D molecular visualization: 86molViewer = os.environ.get('RD_MOLVIEWER', 'PYMOL').upper() 87