Commit faf44dc4 authored by Daniel Salzman's avatar Daniel Salzman

python: improve libknot detection

parent 6a27e8b8
......@@ -45,7 +45,6 @@ Makefile
Makefile.in
version.h
/python/setup.py
/samples/knot.sample.conf
/src/knot/modules/static_modules.h
......@@ -84,4 +83,4 @@ version.h
# eclipse
/.project
/.cproject
/.settings/
\ No newline at end of file
/.settings/
......@@ -21,9 +21,10 @@ AC_CANONICAL_HOST
# Update library versions
# https://www.gnu.org/software/libtool/manual/html_node/Updating-version-info.html
AC_SUBST([libknot_VERSION_INFO],["-version-info 8:0:0"])
AC_SUBST([libdnssec_VERSION_INFO],["-version-info 6:0:0"])
AC_SUBST([libzscanner_VERSION_INFO],["-version-info 2:0:0"])
AC_SUBST([python_libknot_VERSION], ["8"])
AC_SUBST([libknot_VERSION_INFO], ["-version-info 8:0:0"])
AC_SUBST([libdnssec_VERSION_INFO], ["-version-info 6:0:0"])
AC_SUBST([libzscanner_VERSION_INFO], ["-version-info 2:0:0"])
AC_SUBST([KNOT_VERSION_MAJOR], knot_VERSION_MAJOR)
AC_SUBST([KNOT_VERSION_MINOR], knot_VERSION_MINOR)
......@@ -701,6 +702,7 @@ AC_CONFIG_FILES([Makefile
distro/Makefile
python/Makefile
python/setup.py
python/libknot/__init__.py
src/Makefile
src/knot/modules/static_modules.h
])
......
/libknot/__init__.py
/setup.py
EXTRA_DIST = \
libknot/__init__.py \
libknot/__init__.py.in \
libknot/control.py \
setup.py.in
"""Python libknot interface."""
LIBKNOT_VERSION = "@python_libknot_VERSION@"
......@@ -45,7 +45,17 @@ def load_lib(path=None):
"""Loads the libknot library."""
if path is None:
path = "libknot.dylib" if sys.platform == "darwin" else "libknot.so"
version = ""
try:
from libknot import LIBKNOT_VERSION
version = ".%u" % int(LIBKNOT_VERSION)
except:
pass
if sys.platform == "darwin":
path = "libknot%s.dylib" % version
else:
path = "libknot.so%s" % version
LIB = cdll.LoadLibrary(path)
global CTL_ALLOC
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment