From 13193a3a51f300745e9e2c1ba4126e24f7d85fb7 Mon Sep 17 00:00:00 2001 From: Frank Voorburg Date: Thu, 8 Mar 2018 10:19:42 +0000 Subject: [PATCH] Refs #384. Updated python bindings package for LibOpenBLT, such that it can load the shared library file from the current working directory, if it is present there. git-svn-id: https://svn.code.sf.net/p/openblt/code/trunk@439 5dc33758-31d5-4daf-9ae8-b24bf3d40d73 --- Host/Source/LibOpenBLT/bindings/python/openblt/lib.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/Host/Source/LibOpenBLT/bindings/python/openblt/lib.py b/Host/Source/LibOpenBLT/bindings/python/openblt/lib.py index 923f4a16..18d10edd 100644 --- a/Host/Source/LibOpenBLT/bindings/python/openblt/lib.py +++ b/Host/Source/LibOpenBLT/bindings/python/openblt/lib.py @@ -34,6 +34,7 @@ __docformat__ = 'reStructuredText' # *************************************************************************************** import ctypes import sys +import os # *************************************************************************************** @@ -55,8 +56,13 @@ else: sharedLibrary = 'libopenblt' + sharedLibraryExt -# Get a handle to the shared library. -sharedLibraryHandle = ctypes.CDLL(sharedLibrary) +# Get a handle to the shared library. First assume that the shared library is in the +# current working directory. If not, then assume that it is located somewhere on the +# LD_LIBRARY_PATH. +if os.path.exists(os.path.join(os.getcwd(), sharedLibrary)): + sharedLibraryHandle = ctypes.CDLL(os.path.join(os.getcwd(), sharedLibrary)) +else: + sharedLibraryHandle = ctypes.CDLL(sharedLibrary) # ***************************************************************************************