Skip to content

Commit b73cdf3

Browse files
committed
🚸 improve DLL patch for Z3 on Windows
the patch will now also check for Z3 in site-packages similar to how this is done for mqt-core. Furthermore, the condition on the Python version is dropped as it was obsolete. Signed-off-by: burgholzer <[email protected]>
1 parent b71219e commit b73cdf3

File tree

1 file changed

+12
-2
lines changed

1 file changed

+12
-2
lines changed

src/mqt/qmap/__init__.py

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,17 +17,27 @@ def _dll_patch() -> None:
1717
import sysconfig
1818
from pathlib import Path
1919

20-
bin_dir = Path(sysconfig.get_paths()["purelib"]) / "mqt" / "core" / "bin"
20+
site_packages = Path(sysconfig.get_paths()["purelib"])
21+
bin_dir = site_packages / "mqt" / "core" / "bin"
2122
os.add_dll_directory(str(bin_dir))
2223

23-
if sys.version_info >= (3, 9, 0) and "Z3_ROOT" in os.environ:
24+
if "Z3_ROOT" in os.environ:
2425
lib_path = Path(os.environ["Z3_ROOT"]) / "lib"
2526
if lib_path.exists():
2627
os.add_dll_directory(str(lib_path))
2728
bin_path = Path(os.environ["Z3_ROOT"]) / "bin"
2829
if bin_path.exists():
2930
os.add_dll_directory(str(bin_path))
3031

32+
z3_dir = site_packages / "z3"
33+
if z3_dir.exists():
34+
lib_path = z3_dir / "lib"
35+
if lib_path.exists():
36+
os.add_dll_directory(str(lib_path))
37+
bin_path = z3_dir / "bin"
38+
if bin_path.exists():
39+
os.add_dll_directory(str(bin_path))
40+
3141
_dll_patch()
3242
del _dll_patch
3343

0 commit comments

Comments
 (0)