Skip to content

Commit

Permalink
__init__.py: Windows DLL Support
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 Jul 24, 2023
1 parent ed4ea4e commit bff0d9d
Showing 1 changed file with 18 additions and 1 deletion.
19 changes: 18 additions & 1 deletion Python/pywarpx/__init__.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,27 @@
# Copyright 2016-2022 The WarpX Community
# Copyright 2016-2023 The WarpX Community
#
# This file is part of WarpX.
#
# Authors: Andrew Myers, David Grote, Lorenzo Giacomel, Axel Huebl
# License: BSD-3-Clause-LBNL

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)

from .Algo import algo
from .Amr import amr
from .Amrex import amrex
Expand Down

0 comments on commit bff0d9d

Please sign in to comment.