aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormorefigs <morefigs@gmail.com>2019-02-08 09:50:25 +1100
committerGitHub <noreply@github.com>2019-02-08 09:50:25 +1100
commite4f90840fd10ee2419e01438e44447f366b2a269 (patch)
treec512aa271071cd05cdfb10cdddbae58288425da9
parent293e2aef2f05b0e58ad2974f02458af825de11c7 (diff)
parent5405cb2fd29ec688c02e75a8f0e979cca998ac19 (diff)
downloadpymba-e4f90840fd10ee2419e01438e44447f366b2a269.tar.gz
pymba-e4f90840fd10ee2419e01438e44447f366b2a269.zip
Merge pull request #79 from vascotenner/fix_ld_path
Support for multiple GigE drivers installed on the same system
-rw-r--r--pymba/vimba_c.py28
1 files changed, 16 insertions, 12 deletions
diff --git a/pymba/vimba_c.py b/pymba/vimba_c.py
index 034df6e..30b9d77 100644
--- a/pymba/vimba_c.py
+++ b/pymba/vimba_c.py
@@ -36,32 +36,36 @@ if sys_plat == "win32":
else:
dll_loader = cdll
+
+ def find_so(platform, genicam_path):
+ vimbaC_found = False
+ for tlPath in [p for p in os.environ.get(genicam_path).split(":") if p]:
+ vimba_dir = "/".join(tlPath.split("/")[1:-3])
+ vimbaC_path = "/" + vimba_dir + "/VimbaC/DynamicLib/" + platform + "/libVimbaC.so"
+ if os.path.isfile(vimbaC_path):
+ vimbaC_found = True
+ break
+ if not vimbaC_found:
+ raise OSError('No libVimbaC.so found')
+ return vimbaC_path
if 'x86_64' in os.uname()[4]:
assert os.environ.get(
"GENICAM_GENTL64_PATH"), "you need your GENICAM_GENTL64_PATH environment set. Make sure you have Vimba installed, and you have loaded the /etc/profile.d/ scripts"
- tlPath = [p for p in os.environ.get("GENICAM_GENTL64_PATH").split(":") if p][0]
- vimba_dir = "/".join(tlPath.split("/")[1:-3])
- vimbaC_path = "/" + vimba_dir + "/VimbaC/DynamicLib/x86_64bit/libVimbaC.so"
+ vimbaC_path = find_so('x86_64bit', "GENICAM_GENTL64_PATH")
elif 'x86_32' in os.uname()[4]:
print("Warning: x86_32 reached!")
assert os.environ.get(
"GENICAM_GENTL32_PATH"), "you need your GENICAM_GENTL32_PATH environment set. Make sure you have Vimba installed, and you have loaded the /etc/profile.d/ scripts"
- tlPath = [p for p in os.environ.get("GENICAM_GENTL32_PATH").split(":") if p][0]
- vimba_dir = "/".join(tlPath.split("/")[1:-3])
- vimbaC_path = "/" + vimba_dir + "/VimbaC/DynamicLib/x86_32bit/libVimbaC.so"
+ vimbaC_path = find_so('x86_32bit', 'GENICAM_GENTL32_PATH')
elif 'arm' in os.uname()[4]:
assert os.environ.get(
"GENICAM_GENTL32_PATH"), "you need your GENICAM_GENTL32_PATH environment set. Make sure you have Vimba installed, and you have loaded the /etc/profile.d/ scripts"
- tlPath = [p for p in os.environ.get("GENICAM_GENTL32_PATH").split(":") if p][0]
- vimba_dir = "/".join(tlPath.split("/")[1:-3])
- vimbaC_path = "/" + vimba_dir + "/VimbaC/DynamicLib/arm_32bit/libVimbaC.so"
+ vimbaC_path = find_so('arm_32bit', 'GENICAM_GENTL32_PATH')
elif 'aarch64' in os.uname()[4]:
assert os.environ.get(
"GENICAM_GENTL64_PATH"), "you need your GENICAM_GENTL64_PATH environment set. Make sure you have Vimba installed, and you have loaded the /etc/profile.d/ scripts"
- tlPath = [p for p in os.environ.get("GENICAM_GENTL64_PATH").split(":") if p][0]
- vimba_dir = "/".join(tlPath.split("/")[1:-3])
- vimbaC_path = "/" + vimba_dir + "/VimbaC/DynamicLib/arm_64bit/libVimbaC.so"
+ vimbaC_path = find_so('arm_64bit', "GENICAM_GENTL64_PATH")
else:
raise ValueError("Pymba currently doesn't support %s" % os.uname()[4])