diff options
| author | morefigs <morefigs@gmail.com> | 2019-02-09 15:00:41 +1100 |
|---|---|---|
| committer | morefigs <morefigs@gmail.com> | 2019-02-09 15:00:41 +1100 |
| commit | 0adf83d72c081f02cb21510035c7dda8ab07f796 (patch) | |
| tree | 9d41a0eb57e390ec9cd45ccef1a622acb627c337 | |
| parent | 4273a399f5c1aa6b96079d06083aceaa27acc42c (diff) | |
| parent | e4f90840fd10ee2419e01438e44447f366b2a269 (diff) | |
| download | pymba-0adf83d72c081f02cb21510035c7dda8ab07f796.tar.gz pymba-0adf83d72c081f02cb21510035c7dda8ab07f796.zip | |
Merge branch 'master' of github.com:morefigs/pymba
| -rw-r--r-- | pymba/vimba_c.py | 28 |
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]) |
