Code

merge from maint-0-5
[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.19 2002-10-03 06:56:29 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 gadfly': raise
50 else:
51     import back_gadfly
52     gadfly = back_gadfly
53     __all__.append('gadfly')
55 try:
56     import sqlite
57 except ImportError, message:
58     if str(message) != 'No module named sqlite': raise
59 else:
60     import back_sqlite
61     sqlite = back_sqlite
62     __all__.append('sqlite')
64 try:
65     import bsddb
66 except ImportError, message:
67     if str(message) != 'No module named bsddb': raise
68 else:
69     import back_bsddb
70     bsddb = back_bsddb
71     __all__.append('bsddb')
73 try:
74     import bsddb3
75 except ImportError, message:
76     if str(message) != 'No module named bsddb3': raise
77 else:
78     import back_bsddb3
79     bsddb3 = back_bsddb3
80     __all__.append('bsddb3')
82 try:
83     import metakit
84 except ImportError, message:
85     if str(message) != 'No module named metakit': raise
86 else:
87     import back_metakit
88     metakit = back_metakit
89     __all__.append('metakit')
91 # vim: set filetype=python ts=4 sw=4 et si