[pypy-svn] r59145 - pypy/trunk/pypy/lib
fijal at codespeak.net
fijal at codespeak.net
Thu Oct 16 16:14:57 CEST 2008
Author: fijal
Date: Thu Oct 16 16:14:57 2008
New Revision: 59145
Modified:
pypy/trunk/pypy/lib/dbm.py
Log:
A bit hopeless way to avoid dependencies at least for my system...
Modified: pypy/trunk/pypy/lib/dbm.py
==============================================================================
--- pypy/trunk/pypy/lib/dbm.py (original)
+++ pypy/trunk/pypy/lib/dbm.py Thu Oct 16 16:14:57 2008
@@ -1,6 +1,6 @@
from ctypes import *
import ctypes.util
-import os
+import os, sys
_singleton = 'one'
@@ -146,9 +146,13 @@
'delete': 'dbm_delete',
}
-try:
+if sys.platform != 'darwin':
libpath = ctypes.util.find_library('db')
- if not libpath: raise
+ if not libpath:
+ # XXX this is hopeless...
+ libpath = ctypes.util.find_library('db-4.5')
+ if not libpath:
+ raise Exception("Cannot find dbm library")
lib = CDLL(libpath) # Linux
_platform = 'bdb'
lib.__db_ndbm_open.argtypes = [c_char_p, c_int, c_int]
@@ -158,7 +162,7 @@
lib.__db_ndbm_fetch.restype = datum
lib.__db_ndbm_store.restype = c_int
funcs = _bdb_funcs
-except:
+else:
lib = CDLL("/usr/lib/libdbm.dylib") # OS X
_platform = 'osx'
lib.dbm_open.argtypes = [c_char_p, c_int, c_int]
More information about the Pypy-commit
mailing list