Skip to content

Commit

Permalink
Windows: Add PATH to .dll directories
Browse files Browse the repository at this point in the history
Python 3.8+ on Windows: DLL search paths for dependent
shared libraries.

Refs.:
- python/cpython#80266
- https://docs.python.org/3.8/library/os.html#os.add_dll_directory
  • Loading branch information
ax3l committed Nov 16, 2022
1 parent 21f0158 commit 3781856
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions src/amrex/__init__.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,20 @@
import os

# Python 3.8+ on Windows: DLL search paths for dependent
# shared libraries
# Refs.:
# - https://github.com/python/cpython/issues/80266
# - https://docs.python.org/3.8/library/os.html#os.add_dll_directory
if os.name == "nt":
# add anything in the current directory
pwd = __file__.rsplit(os.sep, 1)[0] + os.sep
os.add_dll_directory(pwd)
# add anything in PATH
paths = os.environ.get("PATH", "")
for p in paths.split(";"):
os.add_dll_directory(p)

# import core bindings to C++
from . import amrex_pybind
from .amrex_pybind import * # noqa

Expand Down

0 comments on commit 3781856

Please sign in to comment.