diff --git a/cuda_pathfinder/cuda/pathfinder/_dynamic_libs/search_steps.py b/cuda_pathfinder/cuda/pathfinder/_dynamic_libs/search_steps.py index 1511a9f9872..4e8c7a93b9d 100644 --- a/cuda_pathfinder/cuda/pathfinder/_dynamic_libs/search_steps.py +++ b/cuda_pathfinder/cuda/pathfinder/_dynamic_libs/search_steps.py @@ -55,10 +55,6 @@ class SearchContext: error_messages: list[str] = field(default_factory=list) attachments: list[str] = field(default_factory=list) - @property - def libname(self) -> str: - return self.desc.name # type: ignore[no-any-return] # mypy can't resolve new sibling module - @property def lib_searched_for(self) -> str: return cast(str, self.platform.lib_searched_for(self.desc)) @@ -81,20 +77,6 @@ def _iter_lib_dirs(root: str, rel_dirs: tuple[str, ...]) -> Iterator[str]: yield str(resolve_path(dirname)) -def _iter_lib_dirs_using_anchor( - desc: LibDescriptor, - platform: SearchPlatform, - anchor_point: str, -) -> Iterator[str]: - """Yield existing library directories under *anchor_point* in descriptor order.""" - yield from _iter_lib_dirs(anchor_point, platform.anchor_rel_dirs(desc)) - - -def _find_lib_dir_using_anchor(desc: LibDescriptor, platform: SearchPlatform, anchor_point: str) -> str | None: - """Find the first library directory under *anchor_point*.""" - return next(_iter_lib_dirs_using_anchor(desc, platform, anchor_point), None) - - def _find_using_lib_dir(ctx: SearchContext, lib_dir: str | None) -> str | None: """Find a library file in a resolved lib directory.""" if lib_dir is None: diff --git a/cuda_pathfinder/cuda/pathfinder/_utils/find_sub_dirs.py b/cuda_pathfinder/cuda/pathfinder/_utils/find_sub_dirs.py index 55705ba6393..fd4339ff527 100644 --- a/cuda_pathfinder/cuda/pathfinder/_utils/find_sub_dirs.py +++ b/cuda_pathfinder/cuda/pathfinder/_utils/find_sub_dirs.py @@ -45,10 +45,6 @@ def find_sub_dirs(parent_dirs: Sequence[str], sub_dirs: Sequence[str]) -> list[s return find_sub_dirs_cached(tuple(parent_dirs), tuple(sub_dirs)) -def find_sub_dirs_sys_path(sub_dirs: Sequence[str]) -> list[str]: - return find_sub_dirs(sys.path, sub_dirs) - - def find_sub_dirs_all_sitepackages(sub_dirs: Sequence[str]) -> list[str]: parent_dirs = list(site.getsitepackages()) if site.ENABLE_USER_SITE: diff --git a/cuda_pathfinder/tests/test_search_steps.py b/cuda_pathfinder/tests/test_search_steps.py index 33156411036..a58e9c670c3 100644 --- a/cuda_pathfinder/tests/test_search_steps.py +++ b/cuda_pathfinder/tests/test_search_steps.py @@ -26,7 +26,6 @@ LATE_FIND_STEPS, FindResult, SearchContext, - _find_lib_dir_using_anchor, find_in_conda, find_in_cuda_path, find_in_install_root_env_vars, @@ -90,10 +89,6 @@ def _write_pe(path, machine): class TestSearchContext: - def test_libname_delegates_to_descriptor(self): - ctx = _ctx(_make_desc(name="nvrtc")) - assert ctx.libname == "nvrtc" - def test_lib_searched_for_linux(self): ctx = SearchContext(LIB_DESCRIPTORS["cublas"], platform=LinuxSearchPlatform()) assert ctx.lib_searched_for == "libcublas.so.13 or libcublas.so.12" @@ -1061,48 +1056,6 @@ def test_windows_anchor_dirs_select_x64(self): ) assert WindowsSearchPlatform(target_arch="x64").anchor_rel_dirs(desc) == ("bin/x64", "bin") - def test_find_lib_dir_uses_descriptor_linux(self, tmp_path): - (tmp_path / "nvvm" / "lib64").mkdir(parents=True) - - desc = _make_desc(name="nvvm", anchor_rel_dirs_linux=("nvvm/lib64",)) - result = _find_lib_dir_using_anchor(desc, LinuxSearchPlatform(), str(tmp_path)) - assert result is not None - assert result.endswith(os.path.join("nvvm", "lib64")) - - def test_find_lib_dir_uses_descriptor_windows(self, tmp_path): - (tmp_path / "nvvm" / "bin").mkdir(parents=True) - - desc = _make_desc( - name="nvvm", - anchor_rel_dirs_windows=WindowsSearchDirs( - x64=("nvvm/bin/x64", "nvvm/bin"), - arm64=("nvvm/bin/arm64", "nvvm/bin"), - ), - ) - result = _find_lib_dir_using_anchor(desc, WindowsSearchPlatform(target_arch="x64"), str(tmp_path)) - assert result is not None - assert result.endswith(os.path.join("nvvm", "bin")) - - @pytest.mark.agent_authored(model="gpt-5") - def test_find_lib_dir_windows_arm64_uses_arm64_anchor(self, tmp_path): - (tmp_path / "bin" / "x64").mkdir(parents=True) - (tmp_path / "bin" / "arm64").mkdir(parents=True) - - desc = _make_desc( - name="cudart", - anchor_rel_dirs_windows=WindowsSearchDirs( - x64=("bin/x64", "bin"), - arm64=("bin/arm64",), - ), - ) - result = _find_lib_dir_using_anchor(desc, WindowsSearchPlatform(target_arch="arm64"), str(tmp_path)) - assert result is not None - assert result.endswith(os.path.join("bin", "arm64")) - - def test_find_lib_dir_returns_none_when_no_match(self, tmp_path): - desc = _make_desc(anchor_rel_dirs_linux=("nonexistent",)) - assert _find_lib_dir_using_anchor(desc, LinuxSearchPlatform(), str(tmp_path)) is None - def test_nvvm_cuda_home_linux(self, mocker, tmp_path): """End-to-end: find_in_cuda_path resolves nvvm under its custom subdir.""" mocker.patch(f"{_STEPS_MOD}.get_cuda_path_or_home", return_value=str(tmp_path)) diff --git a/cuda_pathfinder/tests/test_utils_find_sub_dirs.py b/cuda_pathfinder/tests/test_utils_find_sub_dirs.py index 7714e898649..7cd3f92d0dc 100644 --- a/cuda_pathfinder/tests/test_utils_find_sub_dirs.py +++ b/cuda_pathfinder/tests/test_utils_find_sub_dirs.py @@ -8,7 +8,6 @@ from cuda.pathfinder._utils.find_sub_dirs import ( find_sub_dirs, find_sub_dirs_all_sitepackages, - find_sub_dirs_sys_path, ) NONEXISTENT = "NonExistentE12DBF1Fbe948337576B5F1E88f60bb2" @@ -81,11 +80,6 @@ def test_empty_sub_dirs(test_tree): assert sorted(result) == sorted(expected) -def test_find_sub_dirs_sys_path_no_math(): - result = find_sub_dirs_sys_path((NONEXISTENT,)) - assert result == [] - - def test_find_sub_dirs_all_sitepackages_no_match(): result = find_sub_dirs_all_sitepackages((NONEXISTENT,)) assert result == []