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.21 2003-01-12 23:53:19 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 gadfly
47 import gadfly.client
48 except ImportError, message:
49 if str(message) == 'No module named client':
50 # don't keep the old gadfly around
51 del gadfly
52 elif str(message) != 'No module named gadfly':
53 raise
54 else:
55 import back_gadfly
56 gadfly = back_gadfly
57 __all__.append('gadfly')
59 try:
60 import MySQLdb
61 except ImportError, message:
62 if str(message) != 'No module named MySQLdb': raise
63 else:
64 import back_mysql
65 mysql = back_mysql
66 __all__.append('mysql')
68 try:
69 import sqlite
70 except ImportError, message:
71 if str(message) != 'No module named sqlite': raise
72 else:
73 import back_sqlite
74 sqlite = back_sqlite
75 __all__.append('sqlite')
77 try:
78 import bsddb
79 except ImportError, message:
80 if str(message) != 'No module named bsddb': raise
81 else:
82 import back_bsddb
83 bsddb = back_bsddb
84 __all__.append('bsddb')
86 try:
87 import bsddb3
88 except ImportError, message:
89 if str(message) != 'No module named bsddb3': raise
90 else:
91 import back_bsddb3
92 bsddb3 = back_bsddb3
93 __all__.append('bsddb3')
95 try:
96 import metakit
97 except ImportError, message:
98 if str(message) != 'No module named metakit': raise
99 else:
100 import back_metakit
101 metakit = back_metakit
102 __all__.append('metakit')
104 # vim: set filetype=python ts=4 sw=4 et si