Python bindings on OS X
Python bindings for libknot don't work on OS X because the dynamic library is built with the name "libknot.dylib" and not "libknot.so". The following patch should solve it:
--- a/python/libknot/control.py
+++ b/python/libknot/control.py
@@ -27,6 +27,7 @@ Example:
from ctypes import cdll, c_void_p, c_int, c_char_p, c_uint, byref
from enum import IntEnum
+import sys
CTL_ALLOC = None
CTL_FREE = None
@@ -38,9 +39,11 @@ CTL_RECEIVE = None
CTL_ERROR = None
-def load_lib(path="libknot.so"):
+def load_lib(path=None):
"""Loads the libknot library."""
+ if path is None:
+ path = "libknot.dylib" if sys.platform == "darwin" else "libknot.so"
LIB = cdll.LoadLibrary(path)
global CTL_ALLOC