Make libocf.so loading CWD independent
Signed-off-by: Jan Musial <jan.musial@intel.com>
This commit is contained in:
parent
0c6bdaeba4
commit
59178eef01
@ -3,6 +3,8 @@
|
|||||||
# SPDX-License-Identifier: BSD-3-Clause-Clear
|
# SPDX-License-Identifier: BSD-3-Clause-Clear
|
||||||
#
|
#
|
||||||
from ctypes import c_void_p, cdll
|
from ctypes import c_void_p, cdll
|
||||||
|
import inspect
|
||||||
|
import os
|
||||||
|
|
||||||
lib = None
|
lib = None
|
||||||
|
|
||||||
@ -13,7 +15,12 @@ class OcfLib:
|
|||||||
@classmethod
|
@classmethod
|
||||||
def getInstance(cls):
|
def getInstance(cls):
|
||||||
if cls.__lib__ is None:
|
if cls.__lib__ is None:
|
||||||
lib = cdll.LoadLibrary("./pyocf/libocf.so")
|
lib = cdll.LoadLibrary(
|
||||||
|
os.path.join(
|
||||||
|
os.path.dirname(inspect.getfile(inspect.currentframe())),
|
||||||
|
"libocf.so",
|
||||||
|
)
|
||||||
|
)
|
||||||
lib.ocf_volume_get_uuid.restype = c_void_p
|
lib.ocf_volume_get_uuid.restype = c_void_p
|
||||||
lib.ocf_volume_get_uuid.argtypes = [c_void_p]
|
lib.ocf_volume_get_uuid.argtypes = [c_void_p]
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user