Skip to content

Commit 9e0b4a8

Browse files
committed
Universally use cuda.pathfinder._utils.platform_aware.IS_WINDOWS
1 parent ce2ca30 commit 9e0b4a8

File tree

8 files changed

+10
-13
lines changed

8 files changed

+10
-13
lines changed

cuda_pathfinder/cuda/pathfinder/_dynamic_libs/find_nvidia_dynamic_lib.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,13 +9,13 @@
99

1010
from cuda.pathfinder._dynamic_libs.load_dl_common import DynamicLibNotFoundError
1111
from cuda.pathfinder._dynamic_libs.supported_nvidia_libs import (
12-
IS_WINDOWS,
1312
SITE_PACKAGES_LIBDIRS_LINUX,
1413
SITE_PACKAGES_LIBDIRS_WINDOWS,
1514
is_suppressed_dll_file,
1615
)
1716
from cuda.pathfinder._utils.env_vars import get_cuda_home_or_path
1817
from cuda.pathfinder._utils.find_sub_dirs import find_sub_dirs, find_sub_dirs_all_sitepackages
18+
from cuda.pathfinder._utils.platform_aware import IS_WINDOWS
1919

2020

2121
def _no_such_file_in_sub_dirs(

cuda_pathfinder/cuda/pathfinder/_dynamic_libs/load_nvidia_dynamic_lib.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77

88
from cuda.pathfinder._dynamic_libs.find_nvidia_dynamic_lib import _FindNvidiaDynamicLib
99
from cuda.pathfinder._dynamic_libs.load_dl_common import LoadedDL, load_dependencies
10-
from cuda.pathfinder._dynamic_libs.supported_nvidia_libs import IS_WINDOWS
10+
from cuda.pathfinder._utils.platform_aware import IS_WINDOWS
1111

1212
if IS_WINDOWS:
1313
from cuda.pathfinder._dynamic_libs.load_dl_windows import (

cuda_pathfinder/cuda/pathfinder/_dynamic_libs/supported_nvidia_libs.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,7 @@
77
# SUPPORTED_WINDOWS_DLLS
88
# SUPPORTED_LINUX_SONAMES
99

10-
import sys
11-
12-
IS_WINDOWS = sys.platform == "win32"
10+
from cuda.pathfinder._utils.platform_aware import IS_WINDOWS
1311

1412
SUPPORTED_LIBNAMES_COMMON = (
1513
# Core CUDA Runtime and Compiler

cuda_pathfinder/cuda/pathfinder/_headers/find_nvidia_headers.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,9 @@
77
from typing import Optional
88

99
from cuda.pathfinder._headers import supported_nvidia_headers
10-
from cuda.pathfinder._headers.supported_nvidia_headers import IS_WINDOWS
1110
from cuda.pathfinder._utils.env_vars import get_cuda_home_or_path
1211
from cuda.pathfinder._utils.find_sub_dirs import find_sub_dirs_all_sitepackages
12+
from cuda.pathfinder._utils.platform_aware import IS_WINDOWS
1313

1414

1515
def _abs_norm(path: Optional[str]) -> Optional[str]:

cuda_pathfinder/cuda/pathfinder/_headers/supported_nvidia_headers.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,9 @@
11
# SPDX-FileCopyrightText: Copyright (c) 2025 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
22
# SPDX-License-Identifier: Apache-2.0
33

4-
import sys
54
from typing import Final
65

7-
IS_WINDOWS = sys.platform == "win32"
6+
from cuda.pathfinder._utils.platform_aware import IS_WINDOWS
87

98
SUPPORTED_HEADERS_CTK_COMMON = {
109
"cccl": "cuda/std/version",

cuda_pathfinder/tests/child_load_nvidia_dynamic_lib_helper.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,10 +29,10 @@ def child_process_func(libname):
2929
from cuda.pathfinder import DynamicLibNotFoundError, load_nvidia_dynamic_lib
3030
from cuda.pathfinder._dynamic_libs.load_nvidia_dynamic_lib import _load_lib_no_cache
3131
from cuda.pathfinder._dynamic_libs.supported_nvidia_libs import (
32-
IS_WINDOWS,
3332
SUPPORTED_LINUX_SONAMES,
3433
SUPPORTED_WINDOWS_DLLS,
3534
)
35+
from cuda.pathfinder._utils.platform_aware import IS_WINDOWS
3636

3737
try:
3838
loaded_dl_fresh = load_nvidia_dynamic_lib(libname)

cuda_pathfinder/tests/test_find_nvidia_headers.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,11 +22,11 @@
2222

2323
from cuda.pathfinder import find_nvidia_header_directory
2424
from cuda.pathfinder._headers.supported_nvidia_headers import (
25-
IS_WINDOWS,
2625
SUPPORTED_HEADERS_CTK,
2726
SUPPORTED_HEADERS_CTK_ALL,
2827
SUPPORTED_SITE_PACKAGE_HEADER_DIRS_CTK,
2928
)
29+
from cuda.pathfinder._utils.platform_aware import IS_WINDOWS
3030

3131
STRICTNESS = os.environ.get("CUDA_PATHFINDER_TEST_FIND_NVIDIA_HEADERS_STRICTNESS", "see_what_works")
3232
assert STRICTNESS in ("see_what_works", "all_must_work")

cuda_pathfinder/tests/test_load_nvidia_dynamic_lib.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
from cuda.pathfinder._dynamic_libs import supported_nvidia_libs
1515
from cuda.pathfinder._utils.find_site_packages_dll import find_all_dll_files_via_metadata
1616
from cuda.pathfinder._utils.find_site_packages_so import find_all_so_files_via_metadata
17-
from cuda.pathfinder._utils.platform_aware import quote_for_shell
17+
from cuda.pathfinder._utils.platform_aware import IS_WINDOWS, quote_for_shell
1818

1919
STRICTNESS = os.environ.get("CUDA_PATHFINDER_TEST_LOAD_NVIDIA_DYNAMIC_LIB_STRICTNESS", "see_what_works")
2020
assert STRICTNESS in ("see_what_works", "all_must_work")
@@ -74,7 +74,7 @@ def test_runtime_error_on_non_64bit_python():
7474
@functools.cache
7575
def _get_libnames_for_test_load_nvidia_dynamic_lib():
7676
result = list(SUPPORTED_NVIDIA_LIBNAMES)
77-
if supported_nvidia_libs.IS_WINDOWS:
77+
if IS_WINDOWS:
7878
spld_other = supported_nvidia_libs.SITE_PACKAGES_LIBDIRS_WINDOWS_OTHER
7979
all_dyn_libs = find_all_dll_files_via_metadata()
8080
for libname in spld_other:
@@ -98,7 +98,7 @@ def test_load_nvidia_dynamic_lib(info_summary_append, libname):
9898
# to ensure isolation of global dynamic linking state (e.g., dlopen handles).
9999
# Without child processes, loading/unloading libraries during testing could
100100
# interfere across test cases and lead to nondeterministic or platform-specific failures.
101-
timeout = 120 if supported_nvidia_libs.IS_WINDOWS else 30
101+
timeout = 120 if IS_WINDOWS else 30
102102
result = spawned_process_runner.run_in_spawned_child_process(child_process_func, args=(libname,), timeout=timeout)
103103

104104
def raise_child_process_failed():

0 commit comments

Comments
 (0)