1414 SITE_PACKAGES_LIBDIRS_WINDOWS ,
1515 is_suppressed_dll_file ,
1616)
17- from cuda .pathfinder ._utils .find_site_packages_dll import find_all_dll_files_via_metadata
18- from cuda .pathfinder ._utils .find_site_packages_so import find_all_so_files_via_metadata
1917from cuda .pathfinder ._utils .find_sub_dirs import find_sub_dirs , find_sub_dirs_all_sitepackages
2018
2119
@@ -34,7 +32,6 @@ def _find_so_using_nvidia_lib_dirs(
3432) -> Optional [str ]:
3533 rel_dirs = SITE_PACKAGES_LIBDIRS_LINUX .get (libname )
3634 if rel_dirs is not None :
37- # Fast direct access with minimal globbing.
3835 sub_dirs_searched = []
3936 file_wild = so_basename + "*"
4037 for rel_dir in rel_dirs :
@@ -52,14 +49,6 @@ def _find_so_using_nvidia_lib_dirs(
5249 sub_dirs_searched .append (sub_dir )
5350 for sub_dir in sub_dirs_searched :
5451 _no_such_file_in_sub_dirs (sub_dir , file_wild , error_messages , attachments )
55- else :
56- # This fallback is relatively slow, but acceptable.
57- candidates = find_all_so_files_via_metadata ().get (so_basename )
58- if candidates :
59- so_versions = candidates .keys ()
60- # For now, simply take the first candidate after sorting.
61- all_abs_paths : list [str ] = candidates [next (iter (sorted (so_versions )))]
62- return next (iter (sorted (all_abs_paths )))
6352 return None
6453
6554
@@ -77,7 +66,6 @@ def _find_dll_using_nvidia_bin_dirs(
7766) -> Optional [str ]:
7867 rel_dirs = SITE_PACKAGES_LIBDIRS_WINDOWS .get (libname )
7968 if rel_dirs is not None :
80- # Fast direct access with minimal globbing.
8169 sub_dirs_searched = []
8270 for rel_dir in rel_dirs :
8371 sub_dir = tuple (rel_dir .split (os .path .sep ))
@@ -88,20 +76,6 @@ def _find_dll_using_nvidia_bin_dirs(
8876 sub_dirs_searched .append (sub_dir )
8977 for sub_dir in sub_dirs_searched :
9078 _no_such_file_in_sub_dirs (sub_dir , lib_searched_for , error_messages , attachments )
91- else :
92- # This fallback is relatively slow, but acceptable.
93- libname_lower = libname .lower ()
94- candidates = []
95- for relname , abs_paths in find_all_dll_files_via_metadata ().items ():
96- if is_suppressed_dll_file (relname ):
97- continue
98- if relname .startswith (libname_lower ):
99- for abs_path in abs_paths :
100- candidates .append (abs_path )
101- if candidates :
102- candidates .sort ()
103- result : str = candidates [0 ] # help mypy
104- return result
10579 return None
10680
10781
0 commit comments