delete redundant spack.concretize.CHECK_COMPILER_EXISTENCE

This commit is contained in:
Harmen Stoppels 2024-12-09 10:02:51 +01:00 committed by Massimiliano Culpo
parent f1958fbd7e
commit 90d2034d8b
No known key found for this signature in database
GPG Key ID: 3E52BB992233066C
5 changed files with 14 additions and 42 deletions

View File

@ -24,7 +24,6 @@
import spack import spack
import spack.binary_distribution as bindist import spack.binary_distribution as bindist
import spack.builder import spack.builder
import spack.concretize
import spack.config as cfg import spack.config as cfg
import spack.environment as ev import spack.environment as ev
import spack.error import spack.error
@ -375,10 +374,9 @@ def generate_pipeline(env: ev.Environment, args) -> None:
args: (spack.main.SpackArgumentParser): Parsed arguments from the command args: (spack.main.SpackArgumentParser): Parsed arguments from the command
line. line.
""" """
with spack.concretize.disable_compiler_existence_check(): with env.write_transaction():
with env.write_transaction(): env.concretize()
env.concretize() env.write()
env.write()
options = collect_pipeline_options(env, args) options = collect_pipeline_options(env, args)

View File

@ -232,10 +232,8 @@ def build_name(self, spec: Optional[spack.spec.Spec] = None) -> Optional[str]:
Returns: (str) given spec's CDash build name.""" Returns: (str) given spec's CDash build name."""
if spec: if spec:
build_name = ( spec_str = spec.format("{name}{@version}{%compiler} hash={hash} arch={architecture}")
f"{spec.name}@{spec.version}%{spec.compiler} " build_name = f"{spec_str} ({self.build_group})"
f"hash={spec.dag_hash()} arch={spec.architecture} ({self.build_group})"
)
tty.debug(f"Generated CDash build name ({build_name}) from the {spec.name}") tty.debug(f"Generated CDash build name ({build_name}) from the {spec.name}")
return build_name return build_name

View File

@ -10,7 +10,6 @@
import spack.caches import spack.caches
import spack.cmd import spack.cmd
import spack.concretize
import spack.config import spack.config
import spack.environment as ev import spack.environment as ev
import spack.mirrors.mirror import spack.mirrors.mirror
@ -515,16 +514,15 @@ def extend_with_dependencies(specs):
def concrete_specs_from_cli_or_file(args): def concrete_specs_from_cli_or_file(args):
tty.msg("Concretizing input specs") tty.msg("Concretizing input specs")
with spack.concretize.disable_compiler_existence_check(): if args.specs:
if args.specs: specs = spack.cmd.parse_specs(args.specs, concretize=True)
specs = spack.cmd.parse_specs(args.specs, concretize=True) if not specs:
if not specs: raise SpackError("unable to parse specs from command line")
raise SpackError("unable to parse specs from command line")
if args.file: if args.file:
specs = specs_from_text_file(args.file, concretize=True) specs = specs_from_text_file(args.file, concretize=True)
if not specs: if not specs:
raise SpackError("unable to parse specs from file '{}'".format(args.file)) raise SpackError("unable to parse specs from file '{}'".format(args.file))
return specs return specs

View File

@ -4,7 +4,6 @@
"""High-level functions to concretize list of specs""" """High-level functions to concretize list of specs"""
import sys import sys
import time import time
from contextlib import contextmanager
from typing import Iterable, List, Optional, Sequence, Tuple, Union from typing import Iterable, List, Optional, Sequence, Tuple, Union
import llnl.util.tty as tty import llnl.util.tty as tty
@ -17,25 +16,6 @@
import spack.util.parallel import spack.util.parallel
from spack.spec import ArchSpec, CompilerSpec, Spec from spack.spec import ArchSpec, CompilerSpec, Spec
CHECK_COMPILER_EXISTENCE = True
@contextmanager
def disable_compiler_existence_check():
global CHECK_COMPILER_EXISTENCE
CHECK_COMPILER_EXISTENCE, saved = False, CHECK_COMPILER_EXISTENCE
yield
CHECK_COMPILER_EXISTENCE = saved
@contextmanager
def enable_compiler_existence_check():
global CHECK_COMPILER_EXISTENCE
CHECK_COMPILER_EXISTENCE, saved = True, CHECK_COMPILER_EXISTENCE
yield
CHECK_COMPILER_EXISTENCE = saved
SpecPairInput = Tuple[Spec, Optional[Spec]] SpecPairInput = Tuple[Spec, Optional[Spec]]
SpecPair = Tuple[Spec, Spec] SpecPair = Tuple[Spec, Spec]
SpecLike = Union[Spec, str] SpecLike = Union[Spec, str]

View File

@ -7,7 +7,6 @@
import archspec.cpu import archspec.cpu
import spack.concretize
import spack.operating_systems import spack.operating_systems
import spack.platforms import spack.platforms
from spack.spec import ArchSpec, Spec from spack.spec import ArchSpec, Spec
@ -132,6 +131,5 @@ def test_concretize_target_ranges(root_target_range, dep_target_range, result, m
spec = Spec( spec = Spec(
f"pkg-a %gcc@10 foobar=bar target={root_target_range} ^pkg-b target={dep_target_range}" f"pkg-a %gcc@10 foobar=bar target={root_target_range} ^pkg-b target={dep_target_range}"
) )
with spack.concretize.disable_compiler_existence_check(): spec.concretize()
spec.concretize()
assert spec.target == spec["pkg-b"].target == result assert spec.target == spec["pkg-b"].target == result