diff options
author | Szczepan Zalega <szczepan@nitrokey.com> | 2018-01-05 10:06:03 +0100 |
---|---|---|
committer | Szczepan Zalega <szczepan@nitrokey.com> | 2018-01-05 10:07:29 +0100 |
commit | d3d35a3b60b4b41d905821ea4f38b6fcf14ca086 (patch) | |
tree | 356dd5e1de6a85379b6845524e67fcc866b6924f /python_bindings_example.py | |
parent | adb086785942232ebc48b521ded7cee4f6232194 (diff) | |
download | libnitrokey-d3d35a3b60b4b41d905821ea4f38b6fcf14ca086.tar.gz libnitrokey-d3d35a3b60b4b41d905821ea4f38b6fcf14ca086.tar.bz2 |
Handle library names for all OSes
Signed-off-by: Szczepan Zalega <szczepan@nitrokey.com>
Diffstat (limited to 'python_bindings_example.py')
-rwxr-xr-x | python_bindings_example.py | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/python_bindings_example.py b/python_bindings_example.py index 7bb806c..7911846 100755 --- a/python_bindings_example.py +++ b/python_bindings_example.py @@ -41,16 +41,23 @@ def get_library(): C = None import os, sys path_build = os.path.join(".", "build") - paths = [ os.path.join(path_build,"libnitrokey-log.so"), - os.path.join(path_build,"libnitrokey.so")] + paths = [ + os.environ.get('LIBNK_PATH', None), + os.path.join(path_build,"libnitrokey.so"), + os.path.join(path_build,"libnitrokey.dylib"), + os.path.join(path_build,"libnitrokey.dll"), + os.path.join(path_build,"nitrokey.dll"), + ] for p in paths: - print p + if not p: continue + print("Trying " +p) + p = os.path.abspath(p) if os.path.exists(p): + print("Found: "+p) C = ffi.dlopen(p) break else: print("File does not exist: " + p) - print("Trying another") if not C: print("No library file found") sys.exit(1) |