From b926930f36d8a1b62b30bb2993d6949249bf3d01 Mon Sep 17 00:00:00 2001 From: Noah Watkins Date: Sat, 12 Oct 2013 14:53:14 -0700 Subject: [PATCH] pybind: use find_library to look for librados Uses find_library to search for librados, rather than using the soname. For instance, on OSX librados is named librados.2.dylib. Signed-off-by: Noah Watkins --- src/pybind/rados.py | 6 +++++- src/vstart.sh | 1 + 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/src/pybind/rados.py b/src/pybind/rados.py index fecf4bb16d00f..71c4b0cba3202 100644 --- a/src/pybind/rados.py +++ b/src/pybind/rados.py @@ -6,6 +6,7 @@ Copyright 2011, Hannu Valtonen from ctypes import CDLL, c_char_p, c_size_t, c_void_p, c_char, c_int, c_long, \ c_ulong, create_string_buffer, byref, Structure, c_uint64, c_ubyte, \ pointer, CFUNCTYPE +from ctypes.util import find_library import ctypes import errno import threading @@ -194,7 +195,10 @@ Rados object in state %s." % (self.state)) def __init__(self, rados_id=None, name=None, clustername=None, conf_defaults=None, conffile=None, conf=None, flags=0): - self.librados = CDLL('librados.so.2') + librados_path = find_library('rados') + if not librados_path: + raise EnvironmentError("Unable to find librados") + self.librados = CDLL(librados_path) self.cluster = c_void_p() self.rados_id = rados_id if rados_id is not None and not isinstance(rados_id, str): diff --git a/src/vstart.sh b/src/vstart.sh index 4839cc1156d9f..22a32cbe132b9 100755 --- a/src/vstart.sh +++ b/src/vstart.sh @@ -2,6 +2,7 @@ export PYTHONPATH=./pybind export LD_LIBRARY_PATH=.libs +export DYLD_LIBRARY_PATH=$LD_LIBRARY_PATH # abort on failure -- 2.39.5