Skip to content

Commit

Permalink
Support macOS in libevt
Browse files Browse the repository at this point in the history
  • Loading branch information
harrywong committed Feb 6, 2019
1 parent 17f3229 commit a76d111
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions bind/pyevt/pyevt/libevt.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import os
import sys

from cffi import FFI

Expand Down Expand Up @@ -112,11 +113,18 @@ def init_evt_lib():
int evt_link_sign(evt_link_t*, evt_private_key_t*);
""")

if sys.platform == 'linux':
ext = '.so'
elif sys.platform == 'darwin':
ext = '.dylib'
else:
raise Exception('Not supported platform: {}'.format(sys.platform))

if 'LIBEVT_PATH' in os.environ:
LibEVT.lib = LibEVT.ffi.dlopen(
os.environ['LIBEVT_PATH'] + '/libevt.so')
os.environ['LIBEVT_PATH'] + '/libevt' + ext)
else:
LibEVT.lib = LibEVT.ffi.dlopen('libevt.so')
LibEVT.lib = LibEVT.ffi.dlopen('libevt' + ext)

LibEVT.abi = LibEVT.lib.evt_abi()

Expand Down

0 comments on commit a76d111

Please sign in to comment.