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 17671be
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 0 deletions.
1 change: 1 addition & 0 deletions .github/workflows/windows.yml
Original file line number Diff line number Diff line change
Expand Up @@ -58,4 +58,5 @@ jobs:
if(!$?) { Exit $LASTEXITCODE }
- name: Unit tests
run: |
set PATH="C:/Program Files (x86)/pyAMReX/bin/;%PATH%"
ctest --test-dir build -C Debug --output-on-failure
18 changes: 18 additions & 0 deletions src/amrex/__init__.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,21 @@
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(";"):
if os.path.exists(p):
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 17671be

Please sign in to comment.