4
4
import functools
5
5
import glob
6
6
import os
7
- import sys
8
7
9
8
from cuda .bindings ._path_finder .find_sub_dirs import find_sub_dirs_all_sitepackages
10
- from cuda .bindings ._path_finder .supported_libs import is_suppressed_dll_file
9
+ from cuda .bindings ._path_finder .supported_libs import IS_WINDOWS , is_suppressed_dll_file
11
10
12
11
13
12
def _no_such_file_in_sub_dirs (sub_dirs , file_wild , error_messages , attachments ):
@@ -71,7 +70,7 @@ def _find_lib_dir_using_cuda_home(libname):
71
70
cuda_home = _get_cuda_home ()
72
71
if cuda_home is None :
73
72
return None
74
- if sys . platform == "win32" :
73
+ if IS_WINDOWS :
75
74
if libname == "nvvm" : # noqa: SIM108
76
75
subdirs = (os .path .join ("nvvm" , "bin" ),)
77
76
else :
@@ -118,10 +117,7 @@ def _find_dll_using_lib_dir(lib_dir, libname, error_messages, attachments):
118
117
119
118
120
119
def _find_nvvm_lib_dir_from_other_abs_path (other_abs_path ):
121
- if sys .platform == "win32" :
122
- nvvm_subdir = "bin"
123
- else :
124
- nvvm_subdir = "lib64"
120
+ nvvm_subdir = "bin" if IS_WINDOWS else "lib64"
125
121
while other_abs_path :
126
122
if os .path .isdir (other_abs_path ):
127
123
nvvm_lib_dir = os .path .join (other_abs_path , "nvvm" , nvvm_subdir )
@@ -139,7 +135,7 @@ def __init__(self, libname: str):
139
135
self .abs_path = None
140
136
141
137
cuda_home_lib_dir = _find_lib_dir_using_cuda_home (libname )
142
- if sys . platform == "win32" :
138
+ if IS_WINDOWS :
143
139
self .lib_searched_for = f"{ libname } *.dll"
144
140
if cuda_home_lib_dir is not None :
145
141
self .abs_path = _find_dll_using_lib_dir (
@@ -165,7 +161,7 @@ def retry_with_other_abs_path(self, other_abs_path):
165
161
nvvm_lib_dir = _find_nvvm_lib_dir_from_other_abs_path (other_abs_path )
166
162
if nvvm_lib_dir is None :
167
163
return
168
- if sys . platform == "win32" :
164
+ if IS_WINDOWS :
169
165
self .abs_path = _find_dll_using_lib_dir (nvvm_lib_dir , self .libname , self .error_messages , self .attachments )
170
166
else :
171
167
self .abs_path = _find_so_using_lib_dir (
0 commit comments