Code

16c16f2a2a6548f27dd17b3bbaf17878927b6b1b
[roundup.git] / roundup / backends / __init__.py
1 #
2 # Copyright (c) 2001 Bizar Software Pty Ltd (http://www.bizarsoftware.com.au/)
3 # This module is free software, and you may redistribute it and/or modify
4 # under the same terms as Python, so long as this copyright message and
5 # disclaimer are retained in their original form.
6 #
7 # IN NO EVENT SHALL BIZAR SOFTWARE PTY LTD BE LIABLE TO ANY PARTY FOR
8 # DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING
9 # OUT OF THE USE OF THIS CODE, EVEN IF THE AUTHOR HAS BEEN ADVISED OF THE
10 # POSSIBILITY OF SUCH DAMAGE.
11 #
12 # BIZAR SOFTWARE PTY LTD SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING,
13 # BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
14 # FOR A PARTICULAR PURPOSE.  THE CODE PROVIDED HEREUNDER IS ON AN "AS IS"
15 # BASIS, AND THERE IS NO OBLIGATION WHATSOEVER TO PROVIDE MAINTENANCE,
16 # SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
17
18 # $Id: __init__.py,v 1.23 2003-04-24 06:55:24 richard Exp $
20 ''' Container for the hyperdb storage backend implementations.
22 The __all__ variable is constructed containing only the backends which are
23 available.
24 '''
26 __all__ = []
28 try:
29     import sys, anydbm
30     if not hasattr(sys, 'version_info') or sys.version_info < (2,1,2):
31         import dumbdbm
32         # dumbdbm only works in python 2.1.2+
33         assert anydbm._defaultmod != dumbdbm
34         del anydbm
35         del dumbdbm
36 except AssertionError:
37     print "WARNING: you should upgrade to python 2.1.3"
38 except ImportError, message:
39     if str(message) != 'No module named anydbm': raise
40 else:
41     import back_anydbm
42     anydbm = back_anydbm
43     __all__.append('anydbm')
45 try:
46     import MySQLdb
47 except ImportError, message:
48     if str(message) != 'No module named MySQLdb': raise
49 else:
50     import back_mysql
51     mysql = back_mysql
52     __all__.append('mysql')
54 try:
55     import sqlite
56 except ImportError, message:
57     if str(message) != 'No module named sqlite': raise
58 else:
59     import back_sqlite
60     sqlite = back_sqlite
61     __all__.append('sqlite')
63 try:
64     import bsddb
65 except ImportError, message:
66     if not str(message).startswith('No module named'): raise
67 else:
68     import back_bsddb
69     bsddb = back_bsddb
70     __all__.append('bsddb')
72 try:
73     import bsddb3
74 except ImportError, message:
75     if str(message) != 'No module named bsddb3': raise
76 else:
77     import back_bsddb3
78     bsddb3 = back_bsddb3
79     __all__.append('bsddb3')
81 try:
82     import metakit
83 except ImportError, message:
84     if str(message) != 'No module named metakit': raise
85 else:
86     import back_metakit
87     metakit = back_metakit
88     __all__.append('metakit')
90 # vim: set filetype=python ts=4 sw=4 et si