Skip to content

Commit 84cd715

Browse files
ndgrigorianvlad-perevezentsev
authored andcommitted
Adjust Windows-only logic in __init__.py (#2553)
This PR suggests small changes to Windows-specific logic in `__init__.py` `hasattr(os, "add_dll_directory")` is unnecessary after platform check and is removed, and `sys.platform == "win32"` is used which is more commonly seen in the ecosystem and avoids importing `platform` module
1 parent d3181e6 commit 84cd715

File tree

2 files changed

+4
-7
lines changed

2 files changed

+4
-7
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
3434
* Replaced `ci` section in `.pre-commit-config.yaml` with a new GitHub workflow with scheduled run to autoupdate the `pre-commit` configuration [#2542](https://github.com/IntelPython/dpnp/pull/2542)
3535
* FFT module is updated to perform in-place FFT in intermediate steps of ND FFT [#2543](https://github.com/IntelPython/dpnp/pull/2543)
3636
* Reused dpctl tensor include to enable experimental SYCL namespace for complex types [#2546](https://github.com/IntelPython/dpnp/pull/2546)
37+
* Changed Windows-specific logic in dpnp initialization [#2553](https://github.com/IntelPython/dpnp/pull/2553)
3738

3839
### Deprecated
3940

dpnp/__init__.py

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -40,17 +40,13 @@
4040
# where to search for DLLs towards both DPNP backend and DPCTL Sycl interface,
4141
# otherwise DPNP import will be failing. This is because the libraries
4242
# are not installed under any of default paths where Python is searching.
43-
from platform import system
44-
45-
if system() == "Windows": # pragma: no cover
46-
if hasattr(os, "add_dll_directory"):
47-
os.add_dll_directory(mypath)
48-
os.add_dll_directory(dpctlpath)
4943

44+
if sys.platform == "win32": # pragma: no cover
45+
os.add_dll_directory(mypath)
46+
os.add_dll_directory(dpctlpath)
5047
os.environ["PATH"] = os.pathsep.join(
5148
[os.getenv("PATH", ""), mypath, dpctlpath]
5249
)
53-
5450
# For virtual environments on Windows, add folder with DPC++ libraries
5551
# to the DLL search path
5652
if sys.base_exec_prefix != sys.exec_prefix and os.path.isfile(

0 commit comments

Comments
 (0)