Skip to content

Commit 491cda1

Browse files
committed
Trivial renaming of variables. No functional changes.
1 parent 28cd334 commit 491cda1

File tree

1 file changed

+15
-15
lines changed

1 file changed

+15
-15
lines changed

cuda_bindings/cuda/bindings/_path_finder_utils/find_nvidia_dynamic_library.py

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,8 @@ def _no_such_file_in_sub_dirs(sub_dirs, file_wild, error_messages, attachments):
1818
attachments.append(f" {node}")
1919

2020

21-
def _find_so_using_nvidia_lib_dirs(libbasename, so_basename, error_messages, attachments):
22-
if libbasename == "nvvm": # noqa: SIM108
21+
def _find_so_using_nvidia_lib_dirs(libname, so_basename, error_messages, attachments):
22+
if libname == "nvvm": # noqa: SIM108
2323
nvidia_sub_dirs = ("nvidia", "*", "nvvm", "lib64")
2424
else:
2525
nvidia_sub_dirs = ("nvidia", "*", "lib")
@@ -39,12 +39,12 @@ def _find_so_using_nvidia_lib_dirs(libbasename, so_basename, error_messages, att
3939
return None
4040

4141

42-
def _find_dll_using_nvidia_bin_dirs(libbasename, error_messages, attachments):
43-
if libbasename == "nvvm": # noqa: SIM108
42+
def _find_dll_using_nvidia_bin_dirs(libname, error_messages, attachments):
43+
if libname == "nvvm": # noqa: SIM108
4444
nvidia_sub_dirs = ("nvidia", "*", "nvvm", "bin")
4545
else:
4646
nvidia_sub_dirs = ("nvidia", "*", "bin")
47-
file_wild = libbasename + "*.dll"
47+
file_wild = libname + "*.dll"
4848
for bin_dir in sys_path_find_sub_dirs(nvidia_sub_dirs):
4949
for node in sorted(glob.glob(os.path.join(bin_dir, file_wild))):
5050
dll_name = os.path.join(bin_dir, node)
@@ -93,11 +93,11 @@ def _find_so_using_cudalib_dir(so_basename, error_messages, attachments):
9393
return None
9494

9595

96-
def _find_dll_using_cudalib_dir(libbasename, error_messages, attachments):
96+
def _find_dll_using_cudalib_dir(libname, error_messages, attachments):
9797
cudalib_dir = _get_cuda_paths_info("cudalib_dir", error_messages)
9898
if cudalib_dir is None:
9999
return None
100-
file_wild = libbasename + "*.dll"
100+
file_wild = libname + "*.dll"
101101
for node in sorted(glob.glob(os.path.join(cudalib_dir, file_wild))):
102102
dll_name = os.path.join(cudalib_dir, node)
103103
if os.path.isfile(dll_name):
@@ -110,26 +110,26 @@ def _find_dll_using_cudalib_dir(libbasename, error_messages, attachments):
110110

111111

112112
@functools.cache
113-
def find_nvidia_dynamic_library(libbasename):
113+
def find_nvidia_dynamic_library(name: str) -> str:
114114
error_messages = []
115115
attachments = []
116116

117117
if IS_WIN32:
118-
dll_name = _find_dll_using_nvidia_bin_dirs(libbasename, error_messages, attachments)
118+
dll_name = _find_dll_using_nvidia_bin_dirs(name, error_messages, attachments)
119119
if dll_name is None:
120-
if libbasename == "nvvm":
120+
if name == "nvvm":
121121
dll_name = _get_cuda_paths_info("nvvm", error_messages)
122122
else:
123-
dll_name = _find_dll_using_cudalib_dir(libbasename, error_messages, attachments)
123+
dll_name = _find_dll_using_cudalib_dir(name, error_messages, attachments)
124124
if dll_name is None:
125125
attachments = "\n".join(attachments)
126-
raise RuntimeError(f"Failure finding {libbasename}*.dll: {', '.join(error_messages)}\n{attachments}")
126+
raise RuntimeError(f"Failure finding {name}*.dll: {', '.join(error_messages)}\n{attachments}")
127127
return dll_name
128128

129-
so_basename = f"lib{libbasename}.so"
130-
so_name = _find_so_using_nvidia_lib_dirs(libbasename, so_basename, error_messages, attachments)
129+
so_basename = f"lib{name}.so"
130+
so_name = _find_so_using_nvidia_lib_dirs(name, so_basename, error_messages, attachments)
131131
if so_name is None:
132-
if libbasename == "nvvm":
132+
if name == "nvvm":
133133
so_name = _get_cuda_paths_info("nvvm", error_messages)
134134
else:
135135
so_name = _find_so_using_cudalib_dir(so_basename, error_messages, attachments)

0 commit comments

Comments
 (0)