use packagebase

This commit is contained in:
Harmen Stoppels 2024-08-19 15:33:44 +02:00
parent 57769fac7d
commit a1a2b223b0

View File

@ -18,6 +18,7 @@
import llnl.util.lang import llnl.util.lang
import llnl.util.tty import llnl.util.tty
import spack.package_base
import spack.util.elf as elf_utils import spack.util.elf as elf_utils
import spack.util.environment import spack.util.environment
import spack.util.environment as environment import spack.util.environment as environment
@ -200,7 +201,7 @@ class Finder:
def default_path_hints(self) -> List[str]: def default_path_hints(self) -> List[str]:
return [] return []
def search_patterns(self, *, pkg: Type["spack.package_base.PackageBase"]) -> List[str]: def search_patterns(self, *, pkg: Type[spack.package_base.PackageBase]) -> List[str]:
"""Returns the list of patterns used to match candidate files. """Returns the list of patterns used to match candidate files.
Args: Args:
@ -226,7 +227,7 @@ def prefix_from_path(self, *, path: str) -> str:
raise NotImplementedError("must be implemented by derived classes") raise NotImplementedError("must be implemented by derived classes")
def detect_specs( def detect_specs(
self, *, pkg: Type["spack.package_base.PackageBase"], paths: List[str] self, *, pkg: Type[spack.package_base.PackageBase], paths: List[str]
) -> List[DetectedPackage]: ) -> List[DetectedPackage]:
"""Given a list of files matching the search patterns, returns a list of detected specs. """Given a list of files matching the search patterns, returns a list of detected specs.
@ -327,7 +328,7 @@ class ExecutablesFinder(Finder):
def default_path_hints(self) -> List[str]: def default_path_hints(self) -> List[str]:
return spack.util.environment.get_path("PATH") return spack.util.environment.get_path("PATH")
def search_patterns(self, *, pkg: Type["spack.package_base.PackageBase"]) -> List[str]: def search_patterns(self, *, pkg: Type[spack.package_base.PackageBase]) -> List[str]:
result = [] result = []
if hasattr(pkg, "executables") and hasattr(pkg, "platform_executables"): if hasattr(pkg, "executables") and hasattr(pkg, "platform_executables"):
result = pkg.platform_executables() result = pkg.platform_executables()
@ -353,7 +354,7 @@ class LibrariesFinder(Finder):
DYLD_LIBRARY_PATH, DYLD_FALLBACK_LIBRARY_PATH, and standard system library paths DYLD_LIBRARY_PATH, DYLD_FALLBACK_LIBRARY_PATH, and standard system library paths
""" """
def search_patterns(self, *, pkg: Type["spack.package_base.PackageBase"]) -> List[str]: def search_patterns(self, *, pkg: Type[spack.package_base.PackageBase]) -> List[str]:
result = [] result = []
if hasattr(pkg, "libraries"): if hasattr(pkg, "libraries"):
result = pkg.libraries result = pkg.libraries