File tree Expand file tree Collapse file tree 1 file changed +15
-7
lines changed Expand file tree Collapse file tree 1 file changed +15
-7
lines changed Original file line number Diff line number Diff line change @@ -44,27 +44,35 @@ class Wrapper:
44
44
45
45
def __init__ (self ):
46
46
self .loaded_dll = None
47
- self .lib_object_name = "libcubool.so"
48
47
49
48
try :
50
49
# Try from config if present
51
50
self .load_path = os .environ ["CUBOOL_PATH" ]
52
51
except KeyError :
53
52
# Fallback to package directory
54
53
source_path = pathlib .Path (__file__ ).resolve ()
55
- self .load_path = str (source_path .parent / self .lib_object_name )
54
+ self .load_path = Wrapper .__get_lib_path (source_path .parent )
55
+
56
+ assert self .load_path
56
57
57
58
self .loaded_dll = bridge .load_and_configure (self .load_path )
58
- self ._setup_library ()
59
+ self .__setup_library ()
59
60
60
61
def __del__ (self ):
61
- self ._release_library ()
62
- pass
62
+ self .__release_library ()
63
63
64
- def _setup_library (self ):
64
+ def __setup_library (self ):
65
65
status = self .loaded_dll .cuBool_Initialize (ctypes .c_uint (bridge .get_init_hints (False , False )))
66
66
bridge .check (status )
67
67
68
- def _release_library (self ):
68
+ def __release_library (self ):
69
69
status = self .loaded_dll .cuBool_Finalize ()
70
70
bridge .check (status )
71
+
72
+ @classmethod
73
+ def __get_lib_path (cls , prefix ):
74
+ for entry in os .listdir (prefix ):
75
+ if "cubool" in str (entry ):
76
+ return prefix / entry
77
+
78
+ return None
You can’t perform that action at this time.
0 commit comments