Remove dead code after "spack compiler" reworking
This commit is contained in:
parent
4566ad9c2b
commit
e0d889fb91
@ -173,7 +173,6 @@ class CompilerRemover:
|
|||||||
def __init__(self, configuration: "spack.config.ConfigurationType") -> None:
|
def __init__(self, configuration: "spack.config.ConfigurationType") -> None:
|
||||||
self.configuration = configuration
|
self.configuration = configuration
|
||||||
self.marked_packages_yaml: List[Tuple[str, Any]] = []
|
self.marked_packages_yaml: List[Tuple[str, Any]] = []
|
||||||
self.marked_compilers_yaml: List[Tuple[str, Any]] = []
|
|
||||||
|
|
||||||
def mark_compilers(
|
def mark_compilers(
|
||||||
self, *, match: str, scope: Optional[str] = None
|
self, *, match: str, scope: Optional[str] = None
|
||||||
@ -186,15 +185,11 @@ def mark_compilers(
|
|||||||
scope: scope where to remove the compiler. If None, all writeable scopes are checked.
|
scope: scope where to remove the compiler. If None, all writeable scopes are checked.
|
||||||
"""
|
"""
|
||||||
self.marked_packages_yaml = []
|
self.marked_packages_yaml = []
|
||||||
self.marked_compilers_yaml = []
|
|
||||||
candidate_scopes = [scope]
|
candidate_scopes = [scope]
|
||||||
if scope is None:
|
if scope is None:
|
||||||
candidate_scopes = [x.name for x in self.configuration.writable_scopes]
|
candidate_scopes = [x.name for x in self.configuration.writable_scopes]
|
||||||
|
|
||||||
all_removals = self._mark_in_packages_yaml(match, candidate_scopes)
|
return self._mark_in_packages_yaml(match, candidate_scopes)
|
||||||
all_removals.extend(self._mark_in_compilers_yaml(match, candidate_scopes))
|
|
||||||
|
|
||||||
return all_removals
|
|
||||||
|
|
||||||
def _mark_in_packages_yaml(self, match, candidate_scopes):
|
def _mark_in_packages_yaml(self, match, candidate_scopes):
|
||||||
compiler_package_names = supported_compilers()
|
compiler_package_names = supported_compilers()
|
||||||
@ -235,31 +230,6 @@ def _partition_match(external_yaml):
|
|||||||
)
|
)
|
||||||
return all_removals
|
return all_removals
|
||||||
|
|
||||||
def _mark_in_compilers_yaml(self, match, candidate_scopes):
|
|
||||||
if os.environ.get("SPACK_EXPERIMENTAL_DEPRECATE_COMPILERS_YAML") == "1":
|
|
||||||
return []
|
|
||||||
|
|
||||||
all_removals = []
|
|
||||||
for current_scope in candidate_scopes:
|
|
||||||
compilers_yaml = self.configuration.get("compilers", scope=current_scope)
|
|
||||||
if not compilers_yaml:
|
|
||||||
continue
|
|
||||||
|
|
||||||
def _partition_match(entry):
|
|
||||||
external_specs = CompilerFactory.from_legacy_yaml(entry["compiler"])
|
|
||||||
return not any(x.satisfies(match) for x in external_specs)
|
|
||||||
|
|
||||||
to_keep, to_remove = llnl.util.lang.stable_partition(compilers_yaml, _partition_match)
|
|
||||||
if not to_remove:
|
|
||||||
continue
|
|
||||||
|
|
||||||
compilers_yaml[:] = to_keep
|
|
||||||
self.marked_compilers_yaml.append((current_scope, compilers_yaml))
|
|
||||||
for entry in to_remove:
|
|
||||||
all_removals.extend(CompilerFactory.from_legacy_yaml(entry["compiler"]))
|
|
||||||
|
|
||||||
return all_removals
|
|
||||||
|
|
||||||
def flush(self):
|
def flush(self):
|
||||||
"""Removes from configuration the specs that have been marked by the previous call
|
"""Removes from configuration the specs that have been marked by the previous call
|
||||||
of ``remove_compilers``.
|
of ``remove_compilers``.
|
||||||
@ -267,9 +237,6 @@ def flush(self):
|
|||||||
for scope, packages_yaml in self.marked_packages_yaml:
|
for scope, packages_yaml in self.marked_packages_yaml:
|
||||||
self.configuration.set("packages", packages_yaml, scope=scope)
|
self.configuration.set("packages", packages_yaml, scope=scope)
|
||||||
|
|
||||||
for scope, compilers_yaml in self.marked_compilers_yaml:
|
|
||||||
self.configuration.set("compilers", compilers_yaml, scope=scope)
|
|
||||||
|
|
||||||
|
|
||||||
def compilers_for_arch(
|
def compilers_for_arch(
|
||||||
arch_spec: "spack.spec.ArchSpec", *, scope: Optional[str] = None
|
arch_spec: "spack.spec.ArchSpec", *, scope: Optional[str] = None
|
||||||
@ -379,7 +346,6 @@ def from_legacy_yaml(compiler_dict: Dict[str, Any]) -> List["spack.spec.Spec"]:
|
|||||||
"""Returns a list of external specs, corresponding to a compiler entry
|
"""Returns a list of external specs, corresponding to a compiler entry
|
||||||
from compilers.yaml.
|
from compilers.yaml.
|
||||||
"""
|
"""
|
||||||
# FIXME (compiler as nodes): should we look at targets too?
|
|
||||||
result = []
|
result = []
|
||||||
candidate_paths = [x for x in compiler_dict["paths"].values() if x is not None]
|
candidate_paths = [x for x in compiler_dict["paths"].values() if x is not None]
|
||||||
finder = spack.detection.path.ExecutablesFinder()
|
finder = spack.detection.path.ExecutablesFinder()
|
||||||
@ -399,9 +365,6 @@ def from_legacy_yaml(compiler_dict: Dict[str, Any]) -> List["spack.spec.Spec"]:
|
|||||||
|
|
||||||
result.extend(detected)
|
result.extend(detected)
|
||||||
|
|
||||||
# for item in result:
|
|
||||||
# CompilerFactory._finalize_external_concretization(item)
|
|
||||||
|
|
||||||
return result
|
return result
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
|
Loading…
Reference in New Issue
Block a user