Skip to content

Commit 6c780ce

Browse files
author
Graham Higgins
committed
Handle bsddb3 dependency
1 parent ffca5ea commit 6c780ce

File tree

2 files changed

+8
-4
lines changed

2 files changed

+8
-4
lines changed

rdflib/plugins/sleepycat.py

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,13 @@ def bb(u): return u.encode('utf-8')
55

66
try:
77
from bsddb import db
8+
has_bsddb = True
89
except ImportError:
9-
from bsddb3 import db
10-
10+
try:
11+
from bsddb3 import db
12+
has_bsddb = True
13+
except ImportError:
14+
has_bsddb = False
1115
from os import mkdir
1216
from os.path import exists, abspath
1317
from urllib import pathname2url
@@ -22,6 +26,7 @@ class Sleepycat(Store):
2226
transaction_aware = False
2327

2428
def __init__(self, configuration=None, identifier=None):
29+
if not has_bsddb: raise Exception("No local BerkeleyDB found.")
2530
self.__open = False
2631
self.__identifier = identifier
2732
super(Sleepycat, self).__init__(configuration)
@@ -54,6 +59,7 @@ def is_open(self):
5459
return self.__open
5560

5661
def open(self, path, create=True):
62+
if not has_bsddb: return NO_STORE
5763
homeDir = path
5864

5965
if self.__identifier is None:

tox.ini

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,6 @@ commands =
2626
python setup.py clean --all
2727
python setup.py build
2828
python setup.py nosetests -q --where=./build/src
29-
deps =
30-
bsddb3
3129

3230
[testenv:jython]
3331
commands =

0 commit comments

Comments
 (0)