Improve info messages

This commit is contained in:
Massimiliano Culpo 2025-01-24 14:57:26 +01:00
parent a8dd481bbf
commit fc2793f98f
No known key found for this signature in database
GPG Key ID: 3E52BB992233066C
2 changed files with 10 additions and 4 deletions

View File

@ -7,7 +7,6 @@
import os import os
import re import re
import sys import sys
import warnings
from typing import Any, Dict, List, Optional, Tuple from typing import Any, Dict, List, Optional, Tuple
import archspec.cpu import archspec.cpu
@ -137,7 +136,11 @@ def _init_packages_yaml(
for legacy in legacy_compilers: for legacy in legacy_compilers:
by_name.setdefault(legacy.name, []).append(legacy) by_name.setdefault(legacy.name, []).append(legacy)
spack.detection.update_configuration(by_name, buildable=True, scope=scope) spack.detection.update_configuration(by_name, buildable=True, scope=scope)
warnings.warn("compilers have been automatically converted from existing 'compilers.yaml'") tty.info(
"Compilers have been converted from 'compilers.yaml' and written to "
"'packages.yaml'. Use of 'compilers.yaml' is deprecated, and will be "
"ignored in future versions of Spack"
)
return return
# Look for compilers in PATH # Look for compilers in PATH
@ -146,7 +149,7 @@ def _init_packages_yaml(
raise NoAvailableCompilerError( raise NoAvailableCompilerError(
"no compiler configured, and Spack cannot find working compilers in PATH" "no compiler configured, and Spack cannot find working compilers in PATH"
) )
warnings.warn("compilers have been configured automatically from PATH inspection") tty.info("Compilers have been configured automatically from PATH inspection")
def all_compilers_from( def all_compilers_from(

View File

@ -93,6 +93,7 @@
TransformFunction = Callable[[spack.spec.Spec, List[AspFunction]], List[AspFunction]] TransformFunction = Callable[[spack.spec.Spec, List[AspFunction]], List[AspFunction]]
class OutputConfiguration(NamedTuple): class OutputConfiguration(NamedTuple):
"""Data class that contains configuration on what a clingo solve should output.""" """Data class that contains configuration on what a clingo solve should output."""
@ -3428,7 +3429,9 @@ def possible_compilers(*, configuration) -> List["spack.spec.Spec"]:
continue continue
if c in result: if c in result:
warnings.warn(f"duplicate {c} compiler found. Edit your packages.yaml to remove it.") warnings.warn(
f"duplicate {c.long_spec} compiler found. Edit your packages.yaml to remove it."
)
continue continue
result.add(c) result.add(c)