File tree Expand file tree Collapse file tree 1 file changed +8
-10
lines changed
src/deterministic_gaussian_sampling/dll_handling Expand file tree Collapse file tree 1 file changed +8
-10
lines changed Original file line number Diff line number Diff line change 22import platform
33from pathlib import Path
44
5- import importlib .resources as ir
65import deterministic_gaussian_sampling .type_wrapper .ctypes_wrapper as ctypes_wrapper
76
87def _setup_ctypes_dll (cdll : ctypes .CDLL ) -> ctypes .CDLL :
@@ -114,19 +113,18 @@ def _setup_ctypes_dll(cdll: ctypes.CDLL) -> ctypes.CDLL:
114113 return cdll
115114
116115def load_dll () -> ctypes .CDLL :
117- system = platform . system ()
116+ package_root = Path ( __file__ ). resolve (). parent . parent
118117
118+ system = platform .system ()
119119 if system == "Windows" :
120- subpath = Path ("lib/ windows/ bin/ libapproxLCD.dll" )
120+ dll_rel = Path ("lib" ) / " windows" / " bin" / " libapproxLCD.dll"
121121 elif system == "Linux" :
122- subpath = Path ("lib/ linux/ bin/ libapproxLCD.so" )
122+ dll_rel = Path ("lib" ) / " linux" / " bin" / " libapproxLCD.so"
123123 elif system == "Darwin" :
124- subpath = Path ("lib/ macos/ bin/ libapproxLCD.dylib" )
124+ dll_rel = Path ("lib" ) / " macos" / " bin" / " libapproxLCD.dylib"
125125 else :
126126 raise RuntimeError (f"Unsupported OS: { system } " )
127+
128+ dll_path = package_root / dll_rel
127129
128- # locate file inside wheel
129- with ir .as_file (
130- ir .files ("deterministic_gaussian_sampling" ) / subpath
131- ) as dll_path :
132- return _setup_ctypes_dll (ctypes .CDLL (str (dll_path )))
130+ return _setup_ctypes_dll (ctypes .CDLL (str (dll_path )))
You can’t perform that action at this time.
0 commit comments