diff options
-rwxr-xr-x | gluster/api.py | 12 | ||||
-rw-r--r-- | tox.ini | 1 |
2 files changed, 9 insertions, 4 deletions
diff --git a/gluster/api.py b/gluster/api.py index 1b5d320..6bbd092 100755 --- a/gluster/api.py +++ b/gluster/api.py @@ -32,10 +32,14 @@ if so_file_name is None: # Looks like ctypes is having trouble with dependencies, so just force them to # load with RTLD_GLOBAL until I figure that out. -client = ctypes.CDLL(so_file_name, ctypes.RTLD_GLOBAL, use_errno=True) -# The above statement "may" fail with OSError on some systems if libgfapi.so -# is located in /usr/local/lib/. This happens when glusterfs is installed from -# source. Refer to: http://bugs.python.org/issue18502 +try: + client = ctypes.CDLL(so_file_name, ctypes.RTLD_GLOBAL, use_errno=True) + # The above statement "may" fail with OSError on some systems if + # libgfapi.so is located in /usr/local/lib/. This happens when glusterfs + # is installed from source. Refer to: http://bugs.python.org/issue18502 +except OSError: + raise ImportError("ctypes.CDLL() cannot load {0}. You might want to set " + "LD_LIBRARY_PATH env variable".format(so_file_name)) # Wow, the Linux kernel folks really play nasty games with this structure. If # you look at the man page for stat(2) and then at this definition you'll note @@ -3,6 +3,7 @@ envlist = py26,py27,pep8 [testenv] whitelist_externals=bash +passenv = LD_LIBRARY_PATH setenv = VIRTUAL_ENV={envdir} NOSE_WITH_OPENSTACK=1 NOSE_OPENSTACK_COLOR=1 |