From 5be3fe4555b8479bfeef4150c3eb46b3940b82f5 Mon Sep 17 00:00:00 2001 From: Vitor Santos Costa Date: Mon, 11 Dec 2017 04:01:11 +0000 Subject: [PATCH] access to libs --- packages/python/swig/yap4py/__init__.py.in | 31 ++++++++++++++++++++++ 1 file changed, 31 insertions(+) create mode 100644 packages/python/swig/yap4py/__init__.py.in diff --git a/packages/python/swig/yap4py/__init__.py.in b/packages/python/swig/yap4py/__init__.py.in new file mode 100644 index 000000000..cb93233af --- /dev/null +++ b/packages/python/swig/yap4py/__init__.py.in @@ -0,0 +1,31 @@ +import imp +import os +import ctypes +import glob +import os.path +import platform +import sys + +global yap_lib_path +yap_lib_path = "@CMAKE_INSTALL_FULL_LIBDIR@" + +if platform.system() == 'Windows': + def load( dll ): + dll = glob.glob(os.path.join(yap_lib_path,dll))[0] + dll = os.path.abspath(dll) + ctypes.WinDLL(dll) +elif platform.system() == 'Apple': + def load( dll ): + dll = glob.glob(os.path.join(yap_lib_path,dll))[0] + dll = os.path.abspath(dll) + ctypes.CDLL(dll) + load('libYap.dylib') + load('libPy4YAP.dylib') +else: + def load( dll ): + dll = glob.glob(os.path.join(yap_lib_path,dll))[0] + dll = os.path.abspath(dll) + ctypes.CDLL(dll) + load('libYap.so') + load('libPy4YAP.so') + \ No newline at end of file