Skip to content

Commit 6a7b9d2

Browse files
committed
revert testing
1 parent 6f2f7d1 commit 6a7b9d2

File tree

1 file changed

+8
-10
lines changed

1 file changed

+8
-10
lines changed

src/deterministic_gaussian_sampling/dll_handling/dynamic_dll_loading.py

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
import platform
33
from pathlib import Path
44

5-
import importlib.resources as ir
65
import deterministic_gaussian_sampling.type_wrapper.ctypes_wrapper as ctypes_wrapper
76

87
def _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

116115
def 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)))

0 commit comments

Comments
 (0)