concretization: move single-spec concretization logic to spack.concretize
This resolves a circular import issue between spack.spec and spack.concretize. It requires removing the `Spec.concretize` and `Spec.concretized` methods and updating all call-sites to use `spack.concretize.concretized` instead. This will help with potential future efforts to separate AbstractSpec and ConcreteSpec classes. New import relationship is `spack.concretize` imports from `spack.spec`, but not the other way around.
This commit is contained in:
parent
fc105a1a26
commit
4e9fe1fc5d
@ -35,6 +35,7 @@
|
||||
from llnl.util.lang import GroupedExceptionHandler
|
||||
|
||||
import spack.binary_distribution
|
||||
import spack.concretize
|
||||
import spack.config
|
||||
import spack.detection
|
||||
import spack.mirrors.mirror
|
||||
@ -271,10 +272,10 @@ def try_import(self, module: str, abstract_spec_str: str) -> bool:
|
||||
bootstrapper = ClingoBootstrapConcretizer(configuration=spack.config.CONFIG)
|
||||
concrete_spec = bootstrapper.concretize()
|
||||
else:
|
||||
concrete_spec = spack.spec.Spec(
|
||||
abstract_spec = spack.spec.Spec(
|
||||
abstract_spec_str + " ^" + spec_for_current_python()
|
||||
)
|
||||
concrete_spec.concretize()
|
||||
concrete_spec = spack.concretize.concretized(abstract_spec)
|
||||
|
||||
msg = "[BOOTSTRAP MODULE {0}] Try installing '{1}' from sources"
|
||||
tty.debug(msg.format(module, abstract_spec_str))
|
||||
@ -300,7 +301,7 @@ def try_search_path(self, executables: Tuple[str], abstract_spec_str: str) -> bo
|
||||
# might reduce compilation time by a fair amount
|
||||
_add_externals_if_missing()
|
||||
|
||||
concrete_spec = spack.spec.Spec(abstract_spec_str).concretized()
|
||||
concrete_spec = spack.concretize.concretized(spack.spec.Spec(abstract_spec_str))
|
||||
msg = "[BOOTSTRAP] Try installing '{0}' from sources"
|
||||
tty.debug(msg.format(abstract_spec_str))
|
||||
with spack.config.override(self.mirror_scope):
|
||||
|
@ -199,7 +199,7 @@ def _concretize_spec_pairs(to_concretize, tests=False):
|
||||
# Special case for concretizing a single spec
|
||||
if len(to_concretize) == 1:
|
||||
abstract, concrete = to_concretize[0]
|
||||
return [concrete or abstract.concretized()]
|
||||
return [concrete or spack.concretize.concretized(abstract)]
|
||||
|
||||
# Special case if every spec is either concrete or has an abstract hash
|
||||
if all(
|
||||
@ -251,9 +251,9 @@ def matching_spec_from_env(spec):
|
||||
"""
|
||||
env = ev.active_environment()
|
||||
if env:
|
||||
return env.matching_spec(spec) or spec.concretized()
|
||||
return env.matching_spec(spec) or spack.concretize.concretized(spec)
|
||||
else:
|
||||
return spec.concretized()
|
||||
return spack.concretize.concretized(spec)
|
||||
|
||||
|
||||
def matching_specs_from_env(specs):
|
||||
|
@ -15,6 +15,7 @@
|
||||
import spack.bootstrap
|
||||
import spack.bootstrap.config
|
||||
import spack.bootstrap.core
|
||||
import spack.concretize
|
||||
import spack.config
|
||||
import spack.mirrors.utils
|
||||
import spack.spec
|
||||
@ -398,7 +399,7 @@ def _mirror(args):
|
||||
llnl.util.tty.msg(msg.format(spec_str, mirror_dir))
|
||||
# Suppress tty from the call below for terser messages
|
||||
llnl.util.tty.set_msg_enabled(False)
|
||||
spec = spack.spec.Spec(spec_str).concretized()
|
||||
spec = spack.concretize.concretized(spack.spec.Spec(spec_str))
|
||||
for node in spec.traverse():
|
||||
spack.mirrors.utils.create(mirror_dir, [node])
|
||||
llnl.util.tty.set_msg_enabled(True)
|
||||
|
@ -17,6 +17,7 @@
|
||||
|
||||
import spack.binary_distribution as bindist
|
||||
import spack.cmd
|
||||
import spack.concretize
|
||||
import spack.config
|
||||
import spack.deptypes as dt
|
||||
import spack.environment as ev
|
||||
@ -555,8 +556,7 @@ def check_fn(args: argparse.Namespace):
|
||||
tty.msg("No specs provided, exiting.")
|
||||
return
|
||||
|
||||
for spec in specs:
|
||||
spec.concretize()
|
||||
specs = [spack.concretize.concretized(s) for s in specs]
|
||||
|
||||
# Next see if there are any configured binary mirrors
|
||||
configured_mirrors = spack.config.get("mirrors", scope=args.scope)
|
||||
@ -624,7 +624,7 @@ def save_specfile_fn(args):
|
||||
root = specs[0]
|
||||
|
||||
if not root.concrete:
|
||||
root.concretize()
|
||||
root = spack.concretize.concretized(root)
|
||||
|
||||
save_dependency_specfiles(
|
||||
root, args.specfile_dir, dependencies=spack.cmd.parse_specs(args.specs)
|
||||
|
@ -19,6 +19,7 @@
|
||||
from llnl.util.symlink import symlink
|
||||
|
||||
import spack.cmd
|
||||
import spack.concretize
|
||||
import spack.environment as ev
|
||||
import spack.installer
|
||||
import spack.store
|
||||
@ -104,7 +105,7 @@ def deprecate(parser, args):
|
||||
)
|
||||
|
||||
if args.install:
|
||||
deprecator = specs[1].concretized()
|
||||
deprecator = spack.concretize.concretized(specs[1])
|
||||
else:
|
||||
deprecator = spack.cmd.disambiguate_spec(specs[1], env, local=True)
|
||||
|
||||
|
@ -11,6 +11,7 @@
|
||||
import spack.build_environment
|
||||
import spack.cmd
|
||||
import spack.cmd.common.arguments
|
||||
import spack.concretize
|
||||
import spack.config
|
||||
import spack.repo
|
||||
from spack.cmd.common import arguments
|
||||
@ -115,7 +116,7 @@ def dev_build(self, args):
|
||||
|
||||
# Forces the build to run out of the source directory.
|
||||
spec.constrain("dev_path=%s" % source_path)
|
||||
spec.concretize()
|
||||
spec = spack.concretize.concretized(spec)
|
||||
|
||||
if spec.installed:
|
||||
tty.error("Already installed in %s" % spec.prefix)
|
||||
|
@ -14,6 +14,7 @@
|
||||
from llnl.util import lang, tty
|
||||
|
||||
import spack.cmd
|
||||
import spack.concretize
|
||||
import spack.config
|
||||
import spack.environment as ev
|
||||
import spack.paths
|
||||
@ -451,7 +452,7 @@ def concrete_specs_from_file(args):
|
||||
else:
|
||||
s = spack.spec.Spec.from_json(f)
|
||||
|
||||
concretized = s.concretized()
|
||||
concretized = spack.concretize.concretized(s)
|
||||
if concretized.dag_hash() != s.dag_hash():
|
||||
msg = 'skipped invalid file "{0}". '
|
||||
msg += "The file does not contain a concrete spec."
|
||||
|
@ -8,6 +8,7 @@
|
||||
|
||||
from llnl.path import convert_to_posix_path
|
||||
|
||||
import spack.concretize
|
||||
import spack.paths
|
||||
import spack.util.executable
|
||||
from spack.spec import Spec
|
||||
@ -66,8 +67,7 @@ def make_installer(parser, args):
|
||||
"""
|
||||
if sys.platform == "win32":
|
||||
output_dir = args.output_dir
|
||||
cmake_spec = Spec("cmake")
|
||||
cmake_spec.concretize()
|
||||
cmake_spec = spack.concretize.concretized(Spec("cmake"))
|
||||
cmake_path = os.path.join(cmake_spec.prefix, "bin", "cmake.exe")
|
||||
cpack_path = os.path.join(cmake_spec.prefix, "bin", "cpack.exe")
|
||||
spack_source = args.spack_source
|
||||
|
@ -493,7 +493,7 @@ def extend_with_additional_versions(specs, num_versions):
|
||||
mirror_specs = spack.mirrors.utils.get_all_versions(specs)
|
||||
else:
|
||||
mirror_specs = spack.mirrors.utils.get_matching_versions(specs, num_versions=num_versions)
|
||||
mirror_specs = [x.concretized() for x in mirror_specs]
|
||||
mirror_specs = [spack.concretize.concretized(x) for x in mirror_specs]
|
||||
return mirror_specs
|
||||
|
||||
|
||||
|
@ -190,10 +190,49 @@ def _concretize_task(packed_arguments: Tuple[int, str, TestsType]) -> Tuple[int,
|
||||
index, spec_str, tests = packed_arguments
|
||||
with tty.SuppressOutput(msg_enabled=False):
|
||||
start = time.time()
|
||||
spec = Spec(spec_str).concretized(tests=tests)
|
||||
spec = concretized(Spec(spec_str), tests=tests)
|
||||
return index, spec, time.time() - start
|
||||
|
||||
|
||||
def concretized(spec: Spec, tests: Union[bool, Iterable[str]] = False) -> Spec:
|
||||
"""Return a concretized copy of the given spec.
|
||||
|
||||
Args:
|
||||
tests: if False disregard 'test' dependencies, if a list of names activate them for
|
||||
the packages in the list, if True activate 'test' dependencies for all packages.
|
||||
"""
|
||||
spec.replace_hash()
|
||||
|
||||
for node in spec.traverse():
|
||||
if not node.name:
|
||||
raise spack.error.SpecError(
|
||||
f"Spec {node} has no name; cannot concretize an anonymous spec"
|
||||
)
|
||||
|
||||
if spec._concrete:
|
||||
return spec.copy()
|
||||
|
||||
allow_deprecated = spack.config.get("config:deprecated", False)
|
||||
solver = spack.solver.asp.Solver()
|
||||
result = solver.solve([spec], tests=tests, allow_deprecated=allow_deprecated)
|
||||
|
||||
# take the best answer
|
||||
opt, i, answer = min(result.answers)
|
||||
name = spec.name
|
||||
# TODO: Consolidate this code with similar code in solve.py
|
||||
if spec.virtual:
|
||||
providers = [s.name for s in answer.values() if s.package.provides(name)]
|
||||
name = providers[0]
|
||||
|
||||
node = spack.solver.asp.SpecBuilder.make_node(pkg=name)
|
||||
assert (
|
||||
node in answer
|
||||
), f"cannot find {name} in the list of specs {','.join([n.pkg for n in answer.keys()])}"
|
||||
|
||||
concretized = answer[node]
|
||||
return concretized
|
||||
|
||||
|
||||
class UnavailableCompilerVersionError(spack.error.SpackError):
|
||||
"""Raised when there is no available compiler that satisfies a
|
||||
compiler spec."""
|
||||
|
@ -59,7 +59,7 @@
|
||||
import re
|
||||
import socket
|
||||
import warnings
|
||||
from typing import Any, Callable, Dict, Iterable, List, Match, Optional, Set, Tuple, Union
|
||||
from typing import Any, Callable, Dict, List, Match, Optional, Set, Tuple, Union
|
||||
|
||||
import archspec.cpu
|
||||
|
||||
@ -73,7 +73,6 @@
|
||||
import spack
|
||||
import spack.compiler
|
||||
import spack.compilers
|
||||
import spack.config
|
||||
import spack.deptypes as dt
|
||||
import spack.error
|
||||
import spack.hash_types as ht
|
||||
@ -82,7 +81,6 @@
|
||||
import spack.platforms
|
||||
import spack.provider_index
|
||||
import spack.repo
|
||||
import spack.solver
|
||||
import spack.store
|
||||
import spack.traverse as traverse
|
||||
import spack.util.executable
|
||||
@ -2830,46 +2828,6 @@ def ensure_no_deprecated(root):
|
||||
msg += " For each package listed, choose another spec\n"
|
||||
raise SpecDeprecatedError(msg)
|
||||
|
||||
def concretize(self, tests: Union[bool, Iterable[str]] = False) -> None:
|
||||
"""Concretize the current spec.
|
||||
|
||||
Args:
|
||||
tests: if False disregard 'test' dependencies, if a list of names activate them for
|
||||
the packages in the list, if True activate 'test' dependencies for all packages.
|
||||
"""
|
||||
import spack.solver.asp
|
||||
|
||||
self.replace_hash()
|
||||
|
||||
for node in self.traverse():
|
||||
if not node.name:
|
||||
raise spack.error.SpecError(
|
||||
f"Spec {node} has no name; cannot concretize an anonymous spec"
|
||||
)
|
||||
|
||||
if self._concrete:
|
||||
return
|
||||
|
||||
allow_deprecated = spack.config.get("config:deprecated", False)
|
||||
solver = spack.solver.asp.Solver()
|
||||
result = solver.solve([self], tests=tests, allow_deprecated=allow_deprecated)
|
||||
|
||||
# take the best answer
|
||||
opt, i, answer = min(result.answers)
|
||||
name = self.name
|
||||
# TODO: Consolidate this code with similar code in solve.py
|
||||
if self.virtual:
|
||||
providers = [spec.name for spec in answer.values() if spec.package.provides(name)]
|
||||
name = providers[0]
|
||||
|
||||
node = spack.solver.asp.SpecBuilder.make_node(pkg=name)
|
||||
assert (
|
||||
node in answer
|
||||
), f"cannot find {name} in the list of specs {','.join([n.pkg for n in answer.keys()])}"
|
||||
|
||||
concretized = answer[node]
|
||||
self._dup(concretized)
|
||||
|
||||
def _mark_root_concrete(self, value=True):
|
||||
"""Mark just this spec (not dependencies) concrete."""
|
||||
if (not value) and self.concrete and self.installed:
|
||||
@ -2958,21 +2916,6 @@ def _finalize_concretization(self):
|
||||
for spec in self.traverse():
|
||||
spec._cached_hash(ht.dag_hash)
|
||||
|
||||
def concretized(self, tests: Union[bool, Iterable[str]] = False) -> "spack.spec.Spec":
|
||||
"""This is a non-destructive version of concretize().
|
||||
|
||||
First clones, then returns a concrete version of this package
|
||||
without modifying this package.
|
||||
|
||||
Args:
|
||||
tests (bool or list): if False disregard 'test' dependencies,
|
||||
if a list of names activate them for the packages in the list,
|
||||
if True activate 'test' dependencies for all packages.
|
||||
"""
|
||||
clone = self.copy()
|
||||
clone.concretize(tests=tests)
|
||||
return clone
|
||||
|
||||
def index(self, deptype="all"):
|
||||
"""Return a dictionary that points to all the dependencies in this
|
||||
spec.
|
||||
|
@ -8,6 +8,7 @@
|
||||
|
||||
import pytest
|
||||
|
||||
import spack.concretize
|
||||
import spack.config
|
||||
import spack.deptypes as dt
|
||||
import spack.solver.asp
|
||||
@ -22,7 +23,7 @@ def __init__(self, specs: List[str]) -> None:
|
||||
self.concr_specs = []
|
||||
|
||||
def __enter__(self):
|
||||
self.concr_specs = [Spec(s).concretized() for s in self.req_specs]
|
||||
self.concr_specs = [spack.concretize.concretized(Spec(s)) for s in self.req_specs]
|
||||
for s in self.concr_specs:
|
||||
PackageInstaller([s.package], fake=True, explicit=True).install()
|
||||
|
||||
@ -63,13 +64,13 @@ def _has_build_dependency(spec: Spec, name: str):
|
||||
def test_simple_reuse(splicing_setup):
|
||||
with CacheManager(["splice-z@1.0.0+compat"]):
|
||||
spack.config.set("packages", _make_specs_non_buildable(["splice-z"]))
|
||||
assert Spec("splice-z").concretized().satisfies(Spec("splice-z"))
|
||||
assert spack.concretize.concretized(Spec("splice-z")).satisfies(Spec("splice-z"))
|
||||
|
||||
|
||||
def test_simple_dep_reuse(splicing_setup):
|
||||
with CacheManager(["splice-z@1.0.0+compat"]):
|
||||
spack.config.set("packages", _make_specs_non_buildable(["splice-z"]))
|
||||
assert Spec("splice-h@1").concretized().satisfies(Spec("splice-h@1"))
|
||||
assert spack.concretize.concretized(Spec("splice-h@1")).satisfies(Spec("splice-h@1"))
|
||||
|
||||
|
||||
def test_splice_installed_hash(splicing_setup):
|
||||
@ -82,9 +83,9 @@ def test_splice_installed_hash(splicing_setup):
|
||||
spack.config.set("packages", packages_config)
|
||||
goal_spec = Spec("splice-t@1 ^splice-h@1.0.2+compat ^splice-z@1.0.0")
|
||||
with pytest.raises(Exception):
|
||||
goal_spec.concretized()
|
||||
spack.concretize.concretized(goal_spec)
|
||||
_enable_splicing()
|
||||
assert goal_spec.concretized().satisfies(goal_spec)
|
||||
assert spack.concretize.concretized(goal_spec).satisfies(goal_spec)
|
||||
|
||||
|
||||
def test_splice_build_splice_node(splicing_setup):
|
||||
@ -92,9 +93,9 @@ def test_splice_build_splice_node(splicing_setup):
|
||||
spack.config.set("packages", _make_specs_non_buildable(["splice-t"]))
|
||||
goal_spec = Spec("splice-t@1 ^splice-h@1.0.2+compat ^splice-z@1.0.0+compat")
|
||||
with pytest.raises(Exception):
|
||||
goal_spec.concretized()
|
||||
spack.concretize.concretized(goal_spec)
|
||||
_enable_splicing()
|
||||
assert goal_spec.concretized().satisfies(goal_spec)
|
||||
assert spack.concretize.concretized(goal_spec).satisfies(goal_spec)
|
||||
|
||||
|
||||
def test_double_splice(splicing_setup):
|
||||
@ -108,9 +109,9 @@ def test_double_splice(splicing_setup):
|
||||
spack.config.set("packages", freeze_builds_config)
|
||||
goal_spec = Spec("splice-t@1 ^splice-h@1.0.2+compat ^splice-z@1.0.2+compat")
|
||||
with pytest.raises(Exception):
|
||||
goal_spec.concretized()
|
||||
spack.concretize.concretized(goal_spec)
|
||||
_enable_splicing()
|
||||
assert goal_spec.concretized().satisfies(goal_spec)
|
||||
assert spack.concretize.concretized(goal_spec).satisfies(goal_spec)
|
||||
|
||||
|
||||
# The next two tests are mirrors of one another
|
||||
@ -127,10 +128,10 @@ def test_virtual_multi_splices_in(splicing_setup):
|
||||
spack.config.set("packages", _make_specs_non_buildable(["depends-on-virtual-with-abi"]))
|
||||
for gs in goal_specs:
|
||||
with pytest.raises(Exception):
|
||||
Spec(gs).concretized()
|
||||
spack.concretize.concretized(Spec(gs))
|
||||
_enable_splicing()
|
||||
for gs in goal_specs:
|
||||
assert Spec(gs).concretized().satisfies(gs)
|
||||
assert spack.concretize.concretized(Spec(gs)).satisfies(gs)
|
||||
|
||||
|
||||
def test_virtual_multi_can_be_spliced(splicing_setup):
|
||||
@ -144,12 +145,12 @@ def test_virtual_multi_can_be_spliced(splicing_setup):
|
||||
]
|
||||
with CacheManager(cache):
|
||||
spack.config.set("packages", _make_specs_non_buildable(["depends-on-virtual-with-abi"]))
|
||||
with pytest.raises(Exception):
|
||||
for gs in goal_specs:
|
||||
Spec(gs).concretized()
|
||||
for gs in goal_specs:
|
||||
with pytest.raises(Exception):
|
||||
spack.concretize.concretized(Spec(gs))
|
||||
_enable_splicing()
|
||||
for gs in goal_specs:
|
||||
assert Spec(gs).concretized().satisfies(gs)
|
||||
assert spack.concretize.concretized(Spec(gs)).satisfies(gs)
|
||||
|
||||
|
||||
def test_manyvariant_star_matching_variant_splice(splicing_setup):
|
||||
@ -167,10 +168,10 @@ def test_manyvariant_star_matching_variant_splice(splicing_setup):
|
||||
spack.config.set("packages", freeze_build_config)
|
||||
for goal in goal_specs:
|
||||
with pytest.raises(Exception):
|
||||
goal.concretized()
|
||||
spack.concretize.concretized(goal)
|
||||
_enable_splicing()
|
||||
for goal in goal_specs:
|
||||
assert goal.concretized().satisfies(goal)
|
||||
assert spack.concretize.concretized(goal).satisfies(goal)
|
||||
|
||||
|
||||
def test_manyvariant_limited_matching(splicing_setup):
|
||||
@ -189,10 +190,10 @@ def test_manyvariant_limited_matching(splicing_setup):
|
||||
spack.config.set("packages", freeze_build_config)
|
||||
for s in goal_specs:
|
||||
with pytest.raises(Exception):
|
||||
s.concretized()
|
||||
spack.concretize.concretized(s)
|
||||
_enable_splicing()
|
||||
for s in goal_specs:
|
||||
assert s.concretized().satisfies(s)
|
||||
assert spack.concretize.concretized(s).satisfies(s)
|
||||
|
||||
|
||||
def test_external_splice_same_name(splicing_setup):
|
||||
@ -211,7 +212,7 @@ def test_external_splice_same_name(splicing_setup):
|
||||
spack.config.set("packages", packages_yaml)
|
||||
_enable_splicing()
|
||||
for s in goal_specs:
|
||||
assert s.concretized().satisfies(s)
|
||||
assert spack.concretize.concretized(s).satisfies(s)
|
||||
|
||||
|
||||
def test_spliced_build_deps_only_in_build_spec(splicing_setup):
|
||||
@ -220,7 +221,7 @@ def test_spliced_build_deps_only_in_build_spec(splicing_setup):
|
||||
|
||||
with CacheManager(cache):
|
||||
_enable_splicing()
|
||||
concr_goal = goal_spec.concretized()
|
||||
concr_goal = spack.concretize.concretized(goal_spec)
|
||||
build_spec = concr_goal._build_spec
|
||||
# Spec has been spliced
|
||||
assert build_spec is not None
|
||||
@ -238,7 +239,7 @@ def test_spliced_transitive_dependency(splicing_setup):
|
||||
with CacheManager(cache):
|
||||
spack.config.set("packages", _make_specs_non_buildable(["splice-depends-on-t"]))
|
||||
_enable_splicing()
|
||||
concr_goal = goal_spec.concretized()
|
||||
concr_goal = spack.concretize.concretized(goal_spec)
|
||||
# Spec has been spliced
|
||||
assert concr_goal._build_spec is not None
|
||||
assert concr_goal["splice-t"]._build_spec is not None
|
||||
|
@ -134,5 +134,5 @@ def test_concretize_target_ranges(root_target_range, dep_target_range, result, m
|
||||
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 = spack.concretize.concretized(spec)
|
||||
assert spec.target == spec["pkg-b"].target == result
|
||||
|
@ -28,6 +28,7 @@
|
||||
import spack.binary_distribution as bindist
|
||||
import spack.caches
|
||||
import spack.compilers
|
||||
import spack.concretize
|
||||
import spack.config
|
||||
import spack.fetch_strategy
|
||||
import spack.hooks.sbang as sbang
|
||||
@ -213,8 +214,9 @@ def test_default_rpaths_create_install_default_layout(temporary_mirror_dir):
|
||||
Test the creation and installation of buildcaches with default rpaths
|
||||
into the default directory layout scheme.
|
||||
"""
|
||||
gspec, cspec = Spec("garply").concretized(), Spec("corge").concretized()
|
||||
sy_spec = Spec("symly").concretized()
|
||||
gspec = spack.concretize.concretized(Spec("garply"))
|
||||
cspec = spack.concretize.concretized(Spec("corge"))
|
||||
sy_spec = spack.concretize.concretized(Spec("symly"))
|
||||
|
||||
# Install 'corge' without using a cache
|
||||
install_cmd("--no-cache", cspec.name)
|
||||
@ -261,9 +263,9 @@ def test_default_rpaths_install_nondefault_layout(temporary_mirror_dir):
|
||||
Test the creation and installation of buildcaches with default rpaths
|
||||
into the non-default directory layout scheme.
|
||||
"""
|
||||
cspec = Spec("corge").concretized()
|
||||
cspec = spack.concretize.concretized(Spec("corge"))
|
||||
# This guy tests for symlink relocation
|
||||
sy_spec = Spec("symly").concretized()
|
||||
sy_spec = spack.concretize.concretized(Spec("symly"))
|
||||
|
||||
# Install some packages with dependent packages
|
||||
# test install in non-default install path scheme
|
||||
@ -284,7 +286,8 @@ def test_relative_rpaths_install_default_layout(temporary_mirror_dir):
|
||||
Test the creation and installation of buildcaches with relative
|
||||
rpaths into the default directory layout scheme.
|
||||
"""
|
||||
gspec, cspec = Spec("garply").concretized(), Spec("corge").concretized()
|
||||
gspec = spack.concretize.concretized(Spec("garply"))
|
||||
cspec = spack.concretize.concretized(Spec("corge"))
|
||||
|
||||
# Install buildcache created with relativized rpaths
|
||||
buildcache_cmd("install", "-uf", cspec.name)
|
||||
@ -313,7 +316,7 @@ def test_relative_rpaths_install_nondefault(temporary_mirror_dir):
|
||||
Test the installation of buildcaches with relativized rpaths
|
||||
into the non-default directory layout scheme.
|
||||
"""
|
||||
cspec = Spec("corge").concretized()
|
||||
cspec = spack.concretize.concretized(Spec("corge"))
|
||||
|
||||
# Test install in non-default install path scheme and relative path
|
||||
buildcache_cmd("install", "-uf", cspec.name)
|
||||
@ -366,7 +369,8 @@ def test_built_spec_cache(temporary_mirror_dir):
|
||||
that cache from a buildcache index."""
|
||||
buildcache_cmd("list", "-a", "-l")
|
||||
|
||||
gspec, cspec = Spec("garply").concretized(), Spec("corge").concretized()
|
||||
gspec = spack.concretize.concretized(Spec("garply"))
|
||||
cspec = spack.concretize.concretized(Spec("corge"))
|
||||
|
||||
for s in [gspec, cspec]:
|
||||
results = bindist.get_mirrors_for_spec(s)
|
||||
@ -389,7 +393,7 @@ def test_spec_needs_rebuild(monkeypatch, tmpdir):
|
||||
mirror_dir = tmpdir.join("mirror_dir")
|
||||
mirror_url = url_util.path_to_file_url(mirror_dir.strpath)
|
||||
|
||||
s = Spec("libdwarf").concretized()
|
||||
s = spack.concretize.concretized(Spec("libdwarf"))
|
||||
|
||||
# Install a package
|
||||
install_cmd(s.name)
|
||||
@ -418,7 +422,7 @@ def test_generate_index_missing(monkeypatch, tmpdir, mutable_config):
|
||||
mirror_url = url_util.path_to_file_url(mirror_dir.strpath)
|
||||
spack.config.set("mirrors", {"test": mirror_url})
|
||||
|
||||
s = Spec("libdwarf").concretized()
|
||||
s = spack.concretize.concretized(Spec("libdwarf"))
|
||||
|
||||
# Install a package
|
||||
install_cmd("--no-cache", s.name)
|
||||
@ -508,7 +512,7 @@ def test_update_sbang(tmpdir, temporary_mirror):
|
||||
"""
|
||||
spec_str = "old-sbang"
|
||||
# Concretize a package with some old-fashioned sbang lines.
|
||||
old_spec = Spec(spec_str).concretized()
|
||||
old_spec = spack.concretize.concretized(Spec(spec_str))
|
||||
old_spec_hash_str = "/{0}".format(old_spec.dag_hash())
|
||||
|
||||
# Need a fake mirror with *function* scope.
|
||||
@ -529,7 +533,7 @@ def test_update_sbang(tmpdir, temporary_mirror):
|
||||
# Switch the store to the new install tree locations
|
||||
newtree_dir = tmpdir.join("newtree")
|
||||
with spack.store.use_store(str(newtree_dir)):
|
||||
new_spec = Spec("old-sbang").concretized()
|
||||
new_spec = spack.concretize.concretized(Spec("old-sbang"))
|
||||
assert new_spec.dag_hash() == old_spec.dag_hash()
|
||||
|
||||
# Install package from buildcache
|
||||
|
@ -9,6 +9,7 @@
|
||||
import pytest
|
||||
|
||||
import spack.binary_distribution as bd
|
||||
import spack.concretize
|
||||
import spack.mirrors.mirror
|
||||
import spack.spec
|
||||
from spack.installer import PackageInstaller
|
||||
@ -17,7 +18,7 @@
|
||||
|
||||
|
||||
def test_build_tarball_overwrite(install_mockery, mock_fetch, monkeypatch, tmp_path):
|
||||
spec = spack.spec.Spec("trivial-install-test-package").concretized()
|
||||
spec = spack.concretize.concretized(spack.spec.Spec("trivial-install-test-package"))
|
||||
PackageInstaller([spec.package], fake=True).install()
|
||||
|
||||
specs = [spec]
|
||||
|
@ -17,6 +17,7 @@
|
||||
import spack.build_environment
|
||||
import spack.compiler
|
||||
import spack.compilers
|
||||
import spack.concretize
|
||||
import spack.config
|
||||
import spack.deptypes as dt
|
||||
import spack.package_base
|
||||
@ -164,8 +165,7 @@ def test_static_to_shared_library(build_environment):
|
||||
@pytest.mark.regression("8345")
|
||||
@pytest.mark.usefixtures("config", "mock_packages")
|
||||
def test_cc_not_changed_by_modules(monkeypatch, working_env):
|
||||
s = spack.spec.Spec("cmake")
|
||||
s.concretize()
|
||||
s = spack.concretize.concretized(spack.spec.Spec("cmake"))
|
||||
pkg = s.package
|
||||
|
||||
def _set_wrong_cc(x):
|
||||
@ -185,7 +185,7 @@ def test_setup_dependent_package_inherited_modules(
|
||||
working_env, mock_packages, install_mockery, mock_fetch
|
||||
):
|
||||
# This will raise on regression
|
||||
s = spack.spec.Spec("cmake-client-inheritor").concretized()
|
||||
s = spack.concretize.concretized(spack.spec.Spec("cmake-client-inheritor"))
|
||||
PackageInstaller([s.package]).install()
|
||||
|
||||
|
||||
@ -278,7 +278,7 @@ def platform_pathsep(pathlist):
|
||||
return convert_to_platform_path(pathlist)
|
||||
|
||||
# Monkeypatch a pkg.compiler.environment with the required modifications
|
||||
pkg = spack.spec.Spec("cmake").concretized().package
|
||||
pkg = spack.concretize.concretized(spack.spec.Spec("cmake")).package
|
||||
monkeypatch.setattr(pkg.compiler, "environment", modifications)
|
||||
# Trigger the modifications
|
||||
spack.build_environment.setup_package(pkg, False)
|
||||
@ -302,7 +302,7 @@ def custom_env(pkg, env):
|
||||
env.prepend_path("PATH", test_path)
|
||||
env.append_flags("ENV_CUSTOM_CC_FLAGS", "--custom-env-flag1")
|
||||
|
||||
pkg = spack.spec.Spec("cmake").concretized().package
|
||||
pkg = spack.concretize.concretized(spack.spec.Spec("cmake")).package
|
||||
monkeypatch.setattr(pkg.compiler, "setup_custom_environment", custom_env)
|
||||
spack.build_environment.setup_package(pkg, False)
|
||||
|
||||
@ -323,7 +323,7 @@ def test_external_config_env(mock_packages, mutable_config, working_env):
|
||||
}
|
||||
spack.config.set("packages:cmake", cmake_config)
|
||||
|
||||
cmake_client = spack.spec.Spec("cmake-client").concretized()
|
||||
cmake_client = spack.concretize.concretized(spack.spec.Spec("cmake-client"))
|
||||
spack.build_environment.setup_package(cmake_client.package, False)
|
||||
|
||||
assert os.environ["TEST_ENV_VAR_SET"] == "yes it's set"
|
||||
@ -331,8 +331,7 @@ def test_external_config_env(mock_packages, mutable_config, working_env):
|
||||
|
||||
@pytest.mark.regression("9107")
|
||||
def test_spack_paths_before_module_paths(config, mock_packages, monkeypatch, working_env):
|
||||
s = spack.spec.Spec("cmake")
|
||||
s.concretize()
|
||||
s = spack.concretize.concretized(spack.spec.Spec("cmake"))
|
||||
pkg = s.package
|
||||
|
||||
module_path = os.path.join("path", "to", "module")
|
||||
@ -353,8 +352,7 @@ def _set_wrong_cc(x):
|
||||
|
||||
|
||||
def test_package_inheritance_module_setup(config, mock_packages, working_env):
|
||||
s = spack.spec.Spec("multimodule-inheritance")
|
||||
s.concretize()
|
||||
s = spack.concretize.concretized(spack.spec.Spec("multimodule-inheritance"))
|
||||
pkg = s.package
|
||||
|
||||
spack.build_environment.setup_package(pkg, False)
|
||||
@ -388,8 +386,7 @@ def test_wrapper_variables(
|
||||
not in cuda_include_dirs
|
||||
)
|
||||
|
||||
root = spack.spec.Spec("dt-diamond")
|
||||
root.concretize()
|
||||
root = spack.concretize.concretized(spack.spec.Spec("dt-diamond"))
|
||||
|
||||
for s in root.traverse():
|
||||
s.prefix = "/{0}-prefix/".format(s.name)
|
||||
@ -454,7 +451,7 @@ def test_external_prefixes_last(mutable_config, mock_packages, working_env, monk
|
||||
"""
|
||||
)
|
||||
spack.config.set("packages", cfg_data)
|
||||
top = spack.spec.Spec("dt-diamond").concretized()
|
||||
top = spack.concretize.concretized(spack.spec.Spec("dt-diamond"))
|
||||
|
||||
def _trust_me_its_a_dir(path):
|
||||
return True
|
||||
@ -501,8 +498,7 @@ def test_parallel_false_is_not_propagating(default_mock_concretization):
|
||||
)
|
||||
def test_setting_dtags_based_on_config(config_setting, expected_flag, config, mock_packages):
|
||||
# Pick a random package to be able to set compiler's variables
|
||||
s = spack.spec.Spec("cmake")
|
||||
s.concretize()
|
||||
s = spack.concretize.concretized(spack.spec.Spec("cmake"))
|
||||
pkg = s.package
|
||||
|
||||
env = EnvironmentModifications()
|
||||
@ -534,7 +530,7 @@ def setup_dependent_package(module, dependent_spec):
|
||||
assert dependent_module.ninja is not None
|
||||
dependent_spec.package.test_attr = True
|
||||
|
||||
externaltool = spack.spec.Spec("externaltest").concretized()
|
||||
externaltool = spack.concretize.concretized(spack.spec.Spec("externaltest"))
|
||||
monkeypatch.setattr(
|
||||
externaltool["externaltool"].package, "setup_dependent_package", setup_dependent_package
|
||||
)
|
||||
@ -729,7 +725,7 @@ def test_build_system_globals_only_set_on_root_during_build(default_mock_concret
|
||||
But obviously it can lead to very hard to find bugs... We should get rid of those globals and
|
||||
define them instead as a property on the package instance.
|
||||
"""
|
||||
root = spack.spec.Spec("mpileaks").concretized()
|
||||
root = spack.concretize.concretized(spack.spec.Spec("mpileaks"))
|
||||
build_variables = ("std_cmake_args", "std_meson_args", "std_pip_args")
|
||||
|
||||
# See todo above, we clear out any properties that may have been set by the previous test.
|
||||
|
@ -16,6 +16,7 @@
|
||||
import spack.build_systems.autotools
|
||||
import spack.build_systems.cmake
|
||||
import spack.builder
|
||||
import spack.concretize
|
||||
import spack.environment
|
||||
import spack.error
|
||||
import spack.paths
|
||||
@ -145,7 +146,7 @@ def test_none_is_allowed(self, default_mock_concretization):
|
||||
|
||||
def test_libtool_archive_files_are_deleted_by_default(self, mutable_database):
|
||||
# Install a package that creates a mock libtool archive
|
||||
s = Spec("libtool-deletion").concretized()
|
||||
s = spack.concretize.concretized(Spec("libtool-deletion"))
|
||||
PackageInstaller([s.package], explicit=True).install()
|
||||
|
||||
# Assert the libtool archive is not there and we have
|
||||
@ -160,7 +161,7 @@ def test_libtool_archive_files_might_be_installed_on_demand(
|
||||
):
|
||||
# Install a package that creates a mock libtool archive,
|
||||
# patch its package to preserve the installation
|
||||
s = Spec("libtool-deletion").concretized()
|
||||
s = spack.concretize.concretized(Spec("libtool-deletion"))
|
||||
monkeypatch.setattr(
|
||||
type(spack.builder.create(s.package)), "install_libtool_archives", True
|
||||
)
|
||||
@ -174,7 +175,9 @@ def test_autotools_gnuconfig_replacement(self, mutable_database):
|
||||
Tests whether only broken config.sub and config.guess are replaced with
|
||||
files from working alternatives from the gnuconfig package.
|
||||
"""
|
||||
s = Spec("autotools-config-replacement +patch_config_files +gnuconfig").concretized()
|
||||
s = spack.concretize.concretized(
|
||||
Spec("autotools-config-replacement +patch_config_files +gnuconfig")
|
||||
)
|
||||
PackageInstaller([s.package]).install()
|
||||
|
||||
with open(os.path.join(s.prefix.broken, "config.sub")) as f:
|
||||
@ -193,7 +196,9 @@ def test_autotools_gnuconfig_replacement_disabled(self, mutable_database):
|
||||
"""
|
||||
Tests whether disabling patch_config_files
|
||||
"""
|
||||
s = Spec("autotools-config-replacement ~patch_config_files +gnuconfig").concretized()
|
||||
s = spack.concretize.concretized(
|
||||
Spec("autotools-config-replacement ~patch_config_files +gnuconfig")
|
||||
)
|
||||
PackageInstaller([s.package]).install()
|
||||
|
||||
with open(os.path.join(s.prefix.broken, "config.sub")) as f:
|
||||
@ -218,8 +223,9 @@ def test_autotools_gnuconfig_replacement_no_gnuconfig(self, mutable_database, mo
|
||||
enabled, but gnuconfig is not listed as a direct build dependency.
|
||||
"""
|
||||
monkeypatch.setattr(spack.platforms.test.Test, "default", "x86_64")
|
||||
s = Spec("autotools-config-replacement +patch_config_files ~gnuconfig")
|
||||
s.concretize()
|
||||
s = spack.concretize.concretized(
|
||||
Spec("autotools-config-replacement +patch_config_files ~gnuconfig")
|
||||
)
|
||||
|
||||
msg = "Cannot patch config files: missing dependencies: gnuconfig"
|
||||
with pytest.raises(ChildError, match=msg):
|
||||
@ -299,7 +305,7 @@ def test_define(self, default_mock_concretization):
|
||||
assert define("SINGLE", "red") == "-DSINGLE:STRING=red"
|
||||
|
||||
def test_define_from_variant(self):
|
||||
s = Spec("cmake-client multi=up,right ~truthy single=red").concretized()
|
||||
s = spack.concretize.concretized(Spec("cmake-client multi=up,right ~truthy single=red"))
|
||||
|
||||
arg = s.package.define_from_variant("MULTI")
|
||||
assert arg == "-DMULTI:STRING=right;up"
|
||||
|
@ -9,6 +9,7 @@
|
||||
from llnl.util.filesystem import touch
|
||||
|
||||
import spack.builder
|
||||
import spack.concretize
|
||||
import spack.paths
|
||||
import spack.repo
|
||||
import spack.spec
|
||||
@ -79,7 +80,7 @@ def builder_test_repository():
|
||||
@pytest.mark.disable_clean_stage_check
|
||||
def test_callbacks_and_installation_procedure(spec_str, expected_values, working_env):
|
||||
"""Test the correct execution of callbacks and installation procedures for packages."""
|
||||
s = spack.spec.Spec(spec_str).concretized()
|
||||
s = spack.concretize.concretized(spack.spec.Spec(spec_str))
|
||||
builder = spack.builder.create(s.package)
|
||||
for phase_fn in builder:
|
||||
phase_fn.execute()
|
||||
@ -102,7 +103,7 @@ def test_callbacks_and_installation_procedure(spec_str, expected_values, working
|
||||
],
|
||||
)
|
||||
def test_old_style_compatibility_with_super(spec_str, method_name, expected):
|
||||
s = spack.spec.Spec(spec_str).concretized()
|
||||
s = spack.concretize.concretized(spack.spec.Spec(spec_str))
|
||||
builder = spack.builder.create(s.package)
|
||||
value = getattr(builder, method_name)()
|
||||
assert value == expected
|
||||
@ -113,7 +114,7 @@ def test_old_style_compatibility_with_super(spec_str, method_name, expected):
|
||||
@pytest.mark.usefixtures("builder_test_repository", "config", "working_env")
|
||||
@pytest.mark.disable_clean_stage_check
|
||||
def test_build_time_tests_are_executed_from_default_builder():
|
||||
s = spack.spec.Spec("old-style-autotools").concretized()
|
||||
s = spack.concretize.concretized(spack.spec.Spec("old-style-autotools"))
|
||||
builder = spack.builder.create(s.package)
|
||||
builder.pkg.run_tests = True
|
||||
for phase_fn in builder:
|
||||
@ -127,7 +128,7 @@ def test_build_time_tests_are_executed_from_default_builder():
|
||||
@pytest.mark.usefixtures("builder_test_repository", "config", "working_env")
|
||||
def test_monkey_patching_wrapped_pkg():
|
||||
"""Confirm 'run_tests' is accessible through wrappers."""
|
||||
s = spack.spec.Spec("old-style-autotools").concretized()
|
||||
s = spack.concretize.concretized(spack.spec.Spec("old-style-autotools"))
|
||||
builder = spack.builder.create(s.package)
|
||||
assert s.package.run_tests is False
|
||||
assert builder.pkg.run_tests is False
|
||||
@ -142,7 +143,7 @@ def test_monkey_patching_wrapped_pkg():
|
||||
@pytest.mark.usefixtures("builder_test_repository", "config", "working_env")
|
||||
def test_monkey_patching_test_log_file():
|
||||
"""Confirm 'test_log_file' is accessible through wrappers."""
|
||||
s = spack.spec.Spec("old-style-autotools").concretized()
|
||||
s = spack.concretize.concretized(spack.spec.Spec("old-style-autotools"))
|
||||
builder = spack.builder.create(s.package)
|
||||
|
||||
s.package.tester.test_log_file = "/some/file"
|
||||
@ -155,7 +156,7 @@ def test_monkey_patching_test_log_file():
|
||||
@pytest.mark.not_on_windows("Does not run on windows")
|
||||
def test_install_time_test_callback(tmpdir, config, mock_packages, mock_stage):
|
||||
"""Confirm able to run stand-alone test as a post-install callback."""
|
||||
s = spack.spec.Spec("py-test-callback").concretized()
|
||||
s = spack.concretize.concretized(spack.spec.Spec("py-test-callback"))
|
||||
builder = spack.builder.create(s.package)
|
||||
builder.pkg.run_tests = True
|
||||
s.package.tester.test_log_file = tmpdir.join("install_test.log")
|
||||
@ -175,7 +176,7 @@ def test_mixins_with_builders(working_env):
|
||||
"""Tests that run_after and run_before callbacks are accumulated correctly,
|
||||
when mixins are used with builders.
|
||||
"""
|
||||
s = spack.spec.Spec("builder-and-mixins").concretized()
|
||||
s = spack.concretize.concretized(spack.spec.Spec("builder-and-mixins"))
|
||||
builder = spack.builder.create(s.package)
|
||||
|
||||
# Check that callbacks added by the mixin are in the list
|
||||
|
@ -5,6 +5,7 @@
|
||||
|
||||
import pytest
|
||||
|
||||
import spack.concretize
|
||||
import spack.deptypes as dt
|
||||
import spack.installer as inst
|
||||
import spack.repo
|
||||
@ -22,8 +23,7 @@ def test_build_request_errors(install_mockery):
|
||||
|
||||
|
||||
def test_build_request_basics(install_mockery):
|
||||
spec = spack.spec.Spec("dependent-install")
|
||||
spec.concretize()
|
||||
spec = spack.concretize.concretized(spack.spec.Spec("dependent-install"))
|
||||
assert spec.concrete
|
||||
|
||||
# Ensure key properties match expectations
|
||||
@ -40,8 +40,7 @@ def test_build_request_basics(install_mockery):
|
||||
def test_build_request_strings(install_mockery):
|
||||
"""Tests of BuildRequest repr and str for coverage purposes."""
|
||||
# Using a package with one dependency
|
||||
spec = spack.spec.Spec("dependent-install")
|
||||
spec.concretize()
|
||||
spec = spack.concretize.concretized(spack.spec.Spec("dependent-install"))
|
||||
assert spec.concrete
|
||||
|
||||
# Ensure key properties match expectations
|
||||
@ -73,7 +72,7 @@ def test_build_request_deptypes(
|
||||
package_deptypes,
|
||||
dependencies_deptypes,
|
||||
):
|
||||
s = spack.spec.Spec("dependent-install").concretized()
|
||||
s = spack.concretize.concretized(spack.spec.Spec("dependent-install"))
|
||||
|
||||
build_request = inst.BuildRequest(
|
||||
s.package,
|
||||
|
@ -5,6 +5,7 @@
|
||||
|
||||
import pytest
|
||||
|
||||
import spack.concretize
|
||||
import spack.error
|
||||
import spack.installer as inst
|
||||
import spack.repo
|
||||
@ -25,7 +26,7 @@ def test_build_task_errors(install_mockery):
|
||||
inst.BuildTask(pkg_cls(spec), None)
|
||||
|
||||
# Using a concretized package now means the request argument is checked.
|
||||
spec.concretize()
|
||||
spec = spack.concretize.concretized(spec)
|
||||
assert spec.concrete
|
||||
|
||||
with pytest.raises(TypeError, match="is not a valid build request"):
|
||||
@ -48,8 +49,7 @@ def test_build_task_errors(install_mockery):
|
||||
|
||||
|
||||
def test_build_task_basics(install_mockery):
|
||||
spec = spack.spec.Spec("dependent-install")
|
||||
spec.concretize()
|
||||
spec = spack.concretize.concretized(spack.spec.Spec("dependent-install"))
|
||||
assert spec.concrete
|
||||
|
||||
# Ensure key properties match expectations
|
||||
@ -70,8 +70,7 @@ def test_build_task_basics(install_mockery):
|
||||
def test_build_task_strings(install_mockery):
|
||||
"""Tests of build_task repr and str for coverage purposes."""
|
||||
# Using a package with one dependency
|
||||
spec = spack.spec.Spec("dependent-install")
|
||||
spec.concretize()
|
||||
spec = spack.concretize.concretized(spack.spec.Spec("dependent-install"))
|
||||
assert spec.concrete
|
||||
|
||||
# Ensure key properties match expectations
|
||||
|
@ -10,6 +10,7 @@
|
||||
import llnl.util.filesystem as fs
|
||||
|
||||
import spack.ci as ci
|
||||
import spack.concretize
|
||||
import spack.environment as ev
|
||||
import spack.error
|
||||
import spack.paths as spack_paths
|
||||
@ -326,7 +327,7 @@ def test_ci_run_standalone_tests_not_installed_junit(
|
||||
log_file = tmp_path / "junit.xml"
|
||||
args = {
|
||||
"log_file": str(log_file),
|
||||
"job_spec": spack.spec.Spec("printing-package").concretized(),
|
||||
"job_spec": spack.concretize.concretized(spack.spec.Spec("printing-package")),
|
||||
"repro_dir": str(repro_dir),
|
||||
"fail_fast": True,
|
||||
}
|
||||
@ -345,7 +346,7 @@ def test_ci_run_standalone_tests_not_installed_cdash(
|
||||
log_file = tmp_path / "junit.xml"
|
||||
args = {
|
||||
"log_file": str(log_file),
|
||||
"job_spec": spack.spec.Spec("printing-package").concretized(),
|
||||
"job_spec": spack.concretize.concretized(spack.spec.Spec("printing-package")),
|
||||
"repro_dir": str(repro_dir),
|
||||
}
|
||||
|
||||
@ -378,7 +379,7 @@ def test_ci_run_standalone_tests_not_installed_cdash(
|
||||
def test_ci_skipped_report(tmpdir, mock_packages, config):
|
||||
"""Test explicit skipping of report as well as CI's 'package' arg."""
|
||||
pkg = "trivial-smoke-test"
|
||||
spec = spack.spec.Spec(pkg).concretized()
|
||||
spec = spack.concretize.concretized(spack.spec.Spec(pkg))
|
||||
ci_cdash = {
|
||||
"url": "file://fake",
|
||||
"build-group": "fake-group",
|
||||
|
@ -11,11 +11,11 @@
|
||||
|
||||
import spack.bootstrap
|
||||
import spack.bootstrap.core
|
||||
import spack.concretize
|
||||
import spack.config
|
||||
import spack.environment as ev
|
||||
import spack.main
|
||||
import spack.mirrors.utils
|
||||
import spack.spec
|
||||
|
||||
_bootstrap = spack.main.SpackCommand("bootstrap")
|
||||
|
||||
@ -184,7 +184,7 @@ def test_bootstrap_mirror_metadata(mutable_config, linux_os, monkeypatch, tmpdir
|
||||
"""
|
||||
old_create = spack.mirrors.utils.create
|
||||
monkeypatch.setattr(spack.mirrors.utils, "create", lambda p, s: old_create(p, []))
|
||||
monkeypatch.setattr(spack.spec.Spec, "concretized", lambda p: p)
|
||||
monkeypatch.setattr(spack.concretize, "concretized", lambda p: p)
|
||||
|
||||
# Create the mirror in a temporary folder
|
||||
compilers = [
|
||||
|
@ -13,6 +13,7 @@
|
||||
|
||||
import spack.binary_distribution
|
||||
import spack.cmd.buildcache
|
||||
import spack.concretize
|
||||
import spack.environment as ev
|
||||
import spack.error
|
||||
import spack.main
|
||||
@ -82,7 +83,7 @@ def tests_buildcache_create(install_mockery, mock_fetch, monkeypatch, tmpdir):
|
||||
|
||||
buildcache("push", "--unsigned", str(tmpdir), pkg)
|
||||
|
||||
spec = Spec(pkg).concretized()
|
||||
spec = spack.concretize.concretized(Spec(pkg))
|
||||
tarball_path = spack.binary_distribution.tarball_path_name(spec, ".spack")
|
||||
tarball = spack.binary_distribution.tarball_name(spec, ".spec.json")
|
||||
assert os.path.exists(os.path.join(str(tmpdir), "build_cache", tarball_path))
|
||||
@ -102,7 +103,7 @@ def tests_buildcache_create_env(
|
||||
|
||||
buildcache("push", "--unsigned", str(tmpdir))
|
||||
|
||||
spec = Spec(pkg).concretized()
|
||||
spec = spack.concretize.concretized(Spec(pkg))
|
||||
tarball_path = spack.binary_distribution.tarball_path_name(spec, ".spack")
|
||||
tarball = spack.binary_distribution.tarball_name(spec, ".spec.json")
|
||||
assert os.path.exists(os.path.join(str(tmpdir), "build_cache", tarball_path))
|
||||
@ -146,7 +147,7 @@ def test_update_key_index(
|
||||
|
||||
gpg("create", "Test Signing Key", "nobody@nowhere.com")
|
||||
|
||||
s = Spec("libdwarf").concretized()
|
||||
s = spack.concretize.concretized(Spec("libdwarf"))
|
||||
|
||||
# Install a package
|
||||
install(s.name)
|
||||
@ -176,7 +177,7 @@ def test_buildcache_autopush(tmp_path, install_mockery, mock_fetch):
|
||||
mirror("add", "--unsigned", "mirror", mirror_dir.as_uri())
|
||||
mirror("add", "--autopush", "--unsigned", "mirror-autopush", mirror_autopush_dir.as_uri())
|
||||
|
||||
s = Spec("libdwarf").concretized()
|
||||
s = spack.concretize.concretized(Spec("libdwarf"))
|
||||
|
||||
# Install and generate build cache index
|
||||
PackageInstaller([s.package], explicit=True).install()
|
||||
@ -220,7 +221,7 @@ def verify_mirror_contents():
|
||||
assert False
|
||||
|
||||
# Install a package and put it in the buildcache
|
||||
s = Spec(out_env_pkg).concretized()
|
||||
s = spack.concretize.concretized(Spec(out_env_pkg))
|
||||
install(s.name)
|
||||
buildcache("push", "-u", "-f", src_mirror_url, s.name)
|
||||
|
||||
@ -330,7 +331,7 @@ def test_buildcache_create_install(
|
||||
|
||||
buildcache("push", "--unsigned", str(tmpdir), pkg)
|
||||
|
||||
spec = Spec(pkg).concretized()
|
||||
spec = spack.concretize.concretized(Spec(pkg))
|
||||
tarball_path = spack.binary_distribution.tarball_path_name(spec, ".spack")
|
||||
tarball = spack.binary_distribution.tarball_name(spec, ".spec.json")
|
||||
assert os.path.exists(os.path.join(str(tmpdir), "build_cache", tarball_path))
|
||||
@ -451,7 +452,7 @@ def test_push_and_install_with_mirror_marked_unsigned_does_not_require_extra_fla
|
||||
|
||||
|
||||
def test_skip_no_redistribute(mock_packages, config):
|
||||
specs = list(Spec("no-redistribute-dependent").concretized().traverse())
|
||||
specs = list(spack.concretize.concretized(Spec("no-redistribute-dependent")).traverse())
|
||||
filtered = spack.cmd.buildcache._skip_no_redistribute_for_public(specs)
|
||||
assert not any(s.name == "no-redistribute" for s in filtered)
|
||||
assert any(s.name == "no-redistribute-dependent" for s in filtered)
|
||||
@ -491,7 +492,7 @@ def test_push_without_build_deps(tmp_path, temporary_store, mock_packages, mutab
|
||||
|
||||
mirror("add", "--unsigned", "my-mirror", str(tmp_path))
|
||||
|
||||
s = spack.spec.Spec("dtrun3").concretized()
|
||||
s = spack.concretize.concretized(spack.spec.Spec("dtrun3"))
|
||||
PackageInstaller([s.package], explicit=True, fake=True).install()
|
||||
s["dtbuild3"].package.do_uninstall()
|
||||
|
||||
|
@ -8,6 +8,7 @@
|
||||
import pytest
|
||||
|
||||
import spack.cmd.checksum
|
||||
import spack.concretize
|
||||
import spack.error
|
||||
import spack.package_base
|
||||
import spack.repo
|
||||
@ -309,7 +310,7 @@ def test_checksum_url(mock_packages, config):
|
||||
|
||||
|
||||
def test_checksum_verification_fails(default_mock_concretization, capsys, can_fetch_versions):
|
||||
spec = spack.spec.Spec("zlib").concretized()
|
||||
spec = spack.concretize.concretized(spack.spec.Spec("zlib"))
|
||||
pkg = spec.package
|
||||
versions = list(pkg.versions.keys())
|
||||
version_hashes = {versions[0]: "abadhash", Version("0.1"): "123456789"}
|
||||
|
@ -19,6 +19,7 @@
|
||||
import spack.ci as ci
|
||||
import spack.cmd
|
||||
import spack.cmd.ci
|
||||
import spack.concretize
|
||||
import spack.environment as ev
|
||||
import spack.hash_types as ht
|
||||
import spack.main
|
||||
@ -145,7 +146,7 @@ def test_specs_staging(config, tmpdir):
|
||||
builder.add_package("pkg-a", dependencies=[("pkg-b", None, None), ("pkg-c", None, None)])
|
||||
|
||||
with repo.use_repositories(builder.root):
|
||||
spec_a = Spec("pkg-a").concretized()
|
||||
spec_a = spack.concretize.concretized(Spec("pkg-a"))
|
||||
|
||||
spec_a_label = ci._spec_ci_label(spec_a)
|
||||
spec_b_label = ci._spec_ci_label(spec_a["pkg-b"])
|
||||
@ -1108,7 +1109,7 @@ def test_ci_rebuild_index(
|
||||
with working_dir(tmp_path):
|
||||
env_cmd("create", "test", "./spack.yaml")
|
||||
with ev.read("test"):
|
||||
concrete_spec = Spec("callpath").concretized()
|
||||
concrete_spec = spack.concretize.concretized(Spec("callpath"))
|
||||
with open(tmp_path / "spec.json", "w") as f:
|
||||
f.write(concrete_spec.to_json(hash=ht.dag_hash))
|
||||
|
||||
@ -1229,12 +1230,10 @@ def test_ci_generate_read_broken_specs_url(
|
||||
ci_base_environment,
|
||||
):
|
||||
"""Verify that `broken-specs-url` works as intended"""
|
||||
spec_a = Spec("pkg-a")
|
||||
spec_a.concretize()
|
||||
spec_a = spack.concretize.concretized(Spec("pkg-a"))
|
||||
a_dag_hash = spec_a.dag_hash()
|
||||
|
||||
spec_flattendeps = Spec("flatten-deps")
|
||||
spec_flattendeps.concretize()
|
||||
spec_flattendeps = spack.concretize.concretized(Spec("flatten-deps"))
|
||||
flattendeps_dag_hash = spec_flattendeps.dag_hash()
|
||||
|
||||
broken_specs_url = tmp_path.as_uri()
|
||||
@ -1585,8 +1584,7 @@ def dynamic_mapping_setup(tmpdir):
|
||||
"""
|
||||
)
|
||||
|
||||
spec_a = Spec("pkg-a")
|
||||
spec_a.concretize()
|
||||
spec_a = spack.concretize.concretized(Spec("pkg-a"))
|
||||
|
||||
return ci.get_job_name(spec_a)
|
||||
|
||||
|
@ -11,10 +11,10 @@
|
||||
|
||||
import spack.caches
|
||||
import spack.cmd.clean
|
||||
import spack.concretize
|
||||
import spack.environment as ev
|
||||
import spack.main
|
||||
import spack.package_base
|
||||
import spack.spec
|
||||
import spack.stage
|
||||
import spack.store
|
||||
|
||||
@ -78,7 +78,7 @@ def test_env_aware_clean(mock_stage, install_mockery, mutable_mock_env_path, mon
|
||||
def fail(*args, **kwargs):
|
||||
raise Exception("This should not have been called")
|
||||
|
||||
monkeypatch.setattr(spack.spec.Spec, "concretize", fail)
|
||||
monkeypatch.setattr(spack.concretize, "concretized", fail)
|
||||
|
||||
with e:
|
||||
clean("mpileaks")
|
||||
|
@ -9,6 +9,7 @@
|
||||
|
||||
import llnl.util.filesystem as fs
|
||||
|
||||
import spack.concretize
|
||||
import spack.config
|
||||
import spack.database
|
||||
import spack.environment as ev
|
||||
@ -594,8 +595,7 @@ def test_config_prefer_upstream(
|
||||
prepared_db = spack.database.Database(mock_db_root, layout=gen_mock_layout("/a/"))
|
||||
|
||||
for spec in ["hdf5 +mpi", "hdf5 ~mpi", "boost+debug~icu+graph", "dependency-install", "patch"]:
|
||||
dep = spack.spec.Spec(spec)
|
||||
dep.concretize()
|
||||
dep = spack.concretize.concretized(spack.spec.Spec(spec))
|
||||
prepared_db.add(dep)
|
||||
|
||||
downstream_db_root = str(tmpdir_factory.mktemp("mock_downstream_db_root"))
|
||||
|
@ -5,6 +5,7 @@
|
||||
|
||||
import pytest
|
||||
|
||||
import spack.concretize
|
||||
import spack.spec
|
||||
import spack.store
|
||||
from spack.enums import InstallRecordStatus
|
||||
@ -67,8 +68,8 @@ def test_deprecate_deps(mock_packages, mock_archive, mock_fetch, install_mockery
|
||||
install("libdwarf@20130729 ^libelf@0.8.13")
|
||||
install("libdwarf@20130207 ^libelf@0.8.10")
|
||||
|
||||
new_spec = spack.spec.Spec("libdwarf@20130729^libelf@0.8.13").concretized()
|
||||
old_spec = spack.spec.Spec("libdwarf@20130207^libelf@0.8.10").concretized()
|
||||
new_spec = spack.concretize.concretized(spack.spec.Spec("libdwarf@20130729^libelf@0.8.13"))
|
||||
old_spec = spack.concretize.concretized(spack.spec.Spec("libdwarf@20130207^libelf@0.8.10"))
|
||||
|
||||
all_installed = spack.store.STORE.db.query()
|
||||
|
||||
@ -108,12 +109,12 @@ def test_deprecate_already_deprecated(mock_packages, mock_archive, mock_fetch, i
|
||||
install("libelf@0.8.12")
|
||||
install("libelf@0.8.10")
|
||||
|
||||
deprecated_spec = spack.spec.Spec("libelf@0.8.10").concretized()
|
||||
deprecated_spec = spack.concretize.concretized(spack.spec.Spec("libelf@0.8.10"))
|
||||
|
||||
deprecate("-y", "libelf@0.8.10", "libelf@0.8.12")
|
||||
|
||||
deprecator = spack.store.STORE.db.deprecator(deprecated_spec)
|
||||
assert deprecator == spack.spec.Spec("libelf@0.8.12").concretized()
|
||||
assert deprecator == spack.concretize.concretized(spack.spec.Spec("libelf@0.8.12"))
|
||||
|
||||
deprecate("-y", "libelf@0.8.10", "libelf@0.8.13")
|
||||
|
||||
@ -123,7 +124,7 @@ def test_deprecate_already_deprecated(mock_packages, mock_archive, mock_fetch, i
|
||||
assert len(all_available) == 3
|
||||
|
||||
deprecator = spack.store.STORE.db.deprecator(deprecated_spec)
|
||||
assert deprecator == spack.spec.Spec("libelf@0.8.13").concretized()
|
||||
assert deprecator == spack.concretize.concretized(spack.spec.Spec("libelf@0.8.13"))
|
||||
|
||||
|
||||
def test_deprecate_deprecator(mock_packages, mock_archive, mock_fetch, install_mockery):
|
||||
@ -133,9 +134,9 @@ def test_deprecate_deprecator(mock_packages, mock_archive, mock_fetch, install_m
|
||||
install("libelf@0.8.12")
|
||||
install("libelf@0.8.10")
|
||||
|
||||
first_deprecated_spec = spack.spec.Spec("libelf@0.8.10").concretized()
|
||||
second_deprecated_spec = spack.spec.Spec("libelf@0.8.12").concretized()
|
||||
final_deprecator = spack.spec.Spec("libelf@0.8.13").concretized()
|
||||
first_deprecated_spec = spack.concretize.concretized(spack.spec.Spec("libelf@0.8.10"))
|
||||
second_deprecated_spec = spack.concretize.concretized(spack.spec.Spec("libelf@0.8.12"))
|
||||
final_deprecator = spack.concretize.concretized(spack.spec.Spec("libelf@0.8.13"))
|
||||
|
||||
deprecate("-y", "libelf@0.8.10", "libelf@0.8.12")
|
||||
|
||||
@ -165,7 +166,7 @@ def test_concretize_deprecated(mock_packages, mock_archive, mock_fetch, install_
|
||||
|
||||
spec = spack.spec.Spec("libelf@0.8.10")
|
||||
with pytest.raises(spack.spec.SpecDeprecatedError):
|
||||
spec.concretize()
|
||||
spack.concretize.concretized(spec)
|
||||
|
||||
|
||||
@pytest.mark.usefixtures("mock_packages", "mock_archive", "mock_fetch", "install_mockery")
|
||||
|
@ -9,6 +9,7 @@
|
||||
|
||||
import llnl.util.filesystem as fs
|
||||
|
||||
import spack.concretize
|
||||
import spack.environment as ev
|
||||
import spack.error
|
||||
import spack.repo
|
||||
@ -24,7 +25,9 @@
|
||||
|
||||
|
||||
def test_dev_build_basics(tmpdir, install_mockery):
|
||||
spec = spack.spec.Spec(f"dev-build-test-install@0.0.0 dev_path={tmpdir}").concretized()
|
||||
spec = spack.concretize.concretized(
|
||||
spack.spec.Spec(f"dev-build-test-install@0.0.0 dev_path={tmpdir}")
|
||||
)
|
||||
|
||||
assert "dev_path" in spec.variants
|
||||
|
||||
@ -42,7 +45,9 @@ def test_dev_build_basics(tmpdir, install_mockery):
|
||||
|
||||
|
||||
def test_dev_build_before(tmpdir, install_mockery):
|
||||
spec = spack.spec.Spec(f"dev-build-test-install@0.0.0 dev_path={tmpdir}").concretized()
|
||||
spec = spack.concretize.concretized(
|
||||
spack.spec.Spec(f"dev-build-test-install@0.0.0 dev_path={tmpdir}")
|
||||
)
|
||||
|
||||
with tmpdir.as_cwd():
|
||||
with open(spec.package.filename, "w") as f:
|
||||
@ -58,7 +63,9 @@ def test_dev_build_before(tmpdir, install_mockery):
|
||||
|
||||
|
||||
def test_dev_build_until(tmpdir, install_mockery):
|
||||
spec = spack.spec.Spec(f"dev-build-test-install@0.0.0 dev_path={tmpdir}").concretized()
|
||||
spec = spack.concretize.concretized(
|
||||
spack.spec.Spec(f"dev-build-test-install@0.0.0 dev_path={tmpdir}")
|
||||
)
|
||||
|
||||
with tmpdir.as_cwd():
|
||||
with open(spec.package.filename, "w") as f:
|
||||
@ -76,7 +83,9 @@ def test_dev_build_until(tmpdir, install_mockery):
|
||||
|
||||
def test_dev_build_until_last_phase(tmpdir, install_mockery):
|
||||
# Test that we ignore the last_phase argument if it is already last
|
||||
spec = spack.spec.Spec(f"dev-build-test-install@0.0.0 dev_path={tmpdir}").concretized()
|
||||
spec = spack.concretize.concretized(
|
||||
spack.spec.Spec(f"dev-build-test-install@0.0.0 dev_path={tmpdir}")
|
||||
)
|
||||
|
||||
with tmpdir.as_cwd():
|
||||
with open(spec.package.filename, "w") as f:
|
||||
@ -94,7 +103,9 @@ def test_dev_build_until_last_phase(tmpdir, install_mockery):
|
||||
|
||||
|
||||
def test_dev_build_before_until(tmpdir, install_mockery):
|
||||
spec = spack.spec.Spec(f"dev-build-test-install@0.0.0 dev_path={tmpdir}").concretized()
|
||||
spec = spack.concretize.concretized(
|
||||
spack.spec.Spec(f"dev-build-test-install@0.0.0 dev_path={tmpdir}")
|
||||
)
|
||||
|
||||
with tmpdir.as_cwd():
|
||||
with open(spec.package.filename, "w") as f:
|
||||
@ -130,8 +141,9 @@ def test_dev_build_drop_in(tmpdir, mock_packages, monkeypatch, install_mockery,
|
||||
|
||||
|
||||
def test_dev_build_fails_already_installed(tmpdir, install_mockery):
|
||||
spec = spack.spec.Spec("dev-build-test-install@0.0.0 dev_path=%s" % tmpdir)
|
||||
spec.concretize()
|
||||
spec = spack.concretize.concretized(
|
||||
spack.spec.Spec("dev-build-test-install@0.0.0 dev_path=%s" % tmpdir)
|
||||
)
|
||||
|
||||
with tmpdir.as_cwd():
|
||||
with open(spec.package.filename, "w") as f:
|
||||
@ -173,8 +185,9 @@ def test_dev_build_env(tmpdir, install_mockery, mutable_mock_env_path):
|
||||
"""Test Spack does dev builds for packages in develop section of env."""
|
||||
# setup dev-build-test-install package for dev build
|
||||
build_dir = tmpdir.mkdir("build")
|
||||
spec = spack.spec.Spec("dev-build-test-install@0.0.0 dev_path=%s" % build_dir)
|
||||
spec.concretize()
|
||||
spec = spack.concretize.concretized(
|
||||
spack.spec.Spec("dev-build-test-install@0.0.0 dev_path=%s" % build_dir)
|
||||
)
|
||||
|
||||
with build_dir.as_cwd():
|
||||
with open(spec.package.filename, "w") as f:
|
||||
@ -209,8 +222,9 @@ def test_dev_build_env_with_vars(tmpdir, install_mockery, mutable_mock_env_path,
|
||||
"""Test Spack does dev builds for packages in develop section of env (path with variables)."""
|
||||
# setup dev-build-test-install package for dev build
|
||||
build_dir = tmpdir.mkdir("build")
|
||||
spec = spack.spec.Spec(f"dev-build-test-install@0.0.0 dev_path={build_dir}")
|
||||
spec.concretize()
|
||||
spec = spack.concretize.concretized(
|
||||
spack.spec.Spec(f"dev-build-test-install@0.0.0 dev_path={build_dir}")
|
||||
)
|
||||
|
||||
# store the build path in an environment variable that will be used in the environment
|
||||
monkeypatch.setenv("CUSTOM_BUILD_PATH", build_dir)
|
||||
@ -247,8 +261,9 @@ def test_dev_build_env_version_mismatch(tmpdir, install_mockery, mutable_mock_en
|
||||
"""Test Spack constraints concretization by develop specs."""
|
||||
# setup dev-build-test-install package for dev build
|
||||
build_dir = tmpdir.mkdir("build")
|
||||
spec = spack.spec.Spec("dev-build-test-install@0.0.0 dev_path=%s" % tmpdir)
|
||||
spec.concretize()
|
||||
spec = spack.concretize.concretized(
|
||||
spack.spec.Spec("dev-build-test-install@0.0.0 dev_path=%s" % tmpdir)
|
||||
)
|
||||
|
||||
with build_dir.as_cwd():
|
||||
with open(spec.package.filename, "w") as f:
|
||||
@ -328,8 +343,8 @@ def test_dev_build_multiple(tmpdir, install_mockery, mutable_mock_env_path, mock
|
||||
with ev.read("test"):
|
||||
# Do concretization inside environment for dev info
|
||||
# These specs are the source of truth to compare against the installs
|
||||
leaf_spec.concretize()
|
||||
root_spec.concretize()
|
||||
leaf_spec = spack.concretize.concretized(leaf_spec)
|
||||
root_spec = spack.concretize.concretized(root_spec)
|
||||
|
||||
# Do install
|
||||
install()
|
||||
@ -375,8 +390,8 @@ def test_dev_build_env_dependency(tmpdir, install_mockery, mock_fetch, mutable_m
|
||||
# concretize in the environment to get the dev build info
|
||||
# equivalent to setting dev_build and dev_path variants
|
||||
# on all specs above
|
||||
spec.concretize()
|
||||
dep_spec.concretize()
|
||||
spec = spack.concretize.concretized(spec)
|
||||
dep_spec = spack.concretize.concretized(dep_spec)
|
||||
install()
|
||||
|
||||
# Ensure that both specs installed properly
|
||||
@ -400,8 +415,9 @@ def test_dev_build_rebuild_on_source_changes(
|
||||
"""
|
||||
# setup dev-build-test-install package for dev build
|
||||
build_dir = tmpdir.mkdir("build")
|
||||
spec = spack.spec.Spec("dev-build-test-install@0.0.0 dev_path=%s" % build_dir)
|
||||
spec.concretize()
|
||||
spec = spack.concretize.concretized(
|
||||
spack.spec.Spec("dev-build-test-install@0.0.0 dev_path=%s" % build_dir)
|
||||
)
|
||||
|
||||
def reset_string():
|
||||
with build_dir.as_cwd():
|
||||
|
@ -9,6 +9,7 @@
|
||||
|
||||
import llnl.util.filesystem as fs
|
||||
|
||||
import spack.concretize
|
||||
import spack.config
|
||||
import spack.environment as ev
|
||||
import spack.package_base
|
||||
@ -139,7 +140,8 @@ def check_path(stage, dest):
|
||||
self.check_develop(e, spack.spec.Spec("mpich@=1.0"), path)
|
||||
|
||||
# Check modifications actually worked
|
||||
assert spack.spec.Spec("mpich@1.0").concretized().satisfies("dev_path=%s" % abspath)
|
||||
result = spack.concretize.concretized(spack.spec.Spec("mpich@1.0"))
|
||||
assert result.satisfies("dev_path=%s" % abspath)
|
||||
|
||||
def test_develop_canonicalize_path_no_args(self, monkeypatch):
|
||||
env("create", "test")
|
||||
@ -166,7 +168,8 @@ def check_path(stage, dest):
|
||||
self.check_develop(e, spack.spec.Spec("mpich@=1.0"), path)
|
||||
|
||||
# Check modifications actually worked
|
||||
assert spack.spec.Spec("mpich@1.0").concretized().satisfies("dev_path=%s" % abspath)
|
||||
result = spack.concretize.concretized(spack.spec.Spec("mpich@1.0"))
|
||||
assert result.satisfies("dev_path=%s" % abspath)
|
||||
|
||||
|
||||
def _git_commit_list(git_repo_dir):
|
||||
@ -191,7 +194,7 @@ def test_develop_full_git_repo(
|
||||
spack.package_base.PackageBase, "git", "file://%s" % repo_path, raising=False
|
||||
)
|
||||
|
||||
spec = spack.spec.Spec("git-test-commit@1.2").concretized()
|
||||
spec = spack.concretize.concretized(spack.spec.Spec("git-test-commit@1.2"))
|
||||
try:
|
||||
spec.package.do_stage()
|
||||
commits = _git_commit_list(spec.package.stage[0].source_path)
|
||||
|
@ -6,6 +6,7 @@
|
||||
import pytest
|
||||
|
||||
import spack.cmd.diff
|
||||
import spack.concretize
|
||||
import spack.main
|
||||
import spack.repo
|
||||
import spack.spec
|
||||
@ -134,8 +135,8 @@ def test_repo(_create_test_repo, monkeypatch, mock_stage):
|
||||
|
||||
|
||||
def test_diff_ignore(test_repo):
|
||||
specA = spack.spec.Spec("p1+usev1").concretized()
|
||||
specB = spack.spec.Spec("p1~usev1").concretized()
|
||||
specA = spack.concretize.concretized(spack.spec.Spec("p1+usev1"))
|
||||
specB = spack.concretize.concretized(spack.spec.Spec("p1~usev1"))
|
||||
|
||||
c1 = spack.cmd.diff.compare_specs(specA, specB, to_string=False)
|
||||
|
||||
@ -155,8 +156,8 @@ def find(function_list, name, args):
|
||||
|
||||
# Check ignoring changes on multiple packages
|
||||
|
||||
specA = spack.spec.Spec("p1+usev1 ^p3+p3var").concretized()
|
||||
specA = spack.spec.Spec("p1~usev1 ^p3~p3var").concretized()
|
||||
specA = spack.concretize.concretized(spack.spec.Spec("p1+usev1 ^p3+p3var"))
|
||||
specA = spack.concretize.concretized(spack.spec.Spec("p1~usev1 ^p3~p3var"))
|
||||
|
||||
c3 = spack.cmd.diff.compare_specs(specA, specB, to_string=False)
|
||||
assert find(c3["a_not_b"], "variant_value", ["p3", "p3var"])
|
||||
@ -169,8 +170,8 @@ def find(function_list, name, args):
|
||||
def test_diff_cmd(install_mockery, mock_fetch, mock_archive, mock_packages):
|
||||
"""Test that we can install two packages and diff them"""
|
||||
|
||||
specA = spack.spec.Spec("mpileaks").concretized()
|
||||
specB = spack.spec.Spec("mpileaks+debug").concretized()
|
||||
specA = spack.concretize.concretized(spack.spec.Spec("mpileaks"))
|
||||
specB = spack.concretize.concretized(spack.spec.Spec("mpileaks+debug"))
|
||||
|
||||
# Specs should be the same as themselves
|
||||
c = spack.cmd.diff.compare_specs(specA, specA, to_string=True)
|
||||
|
@ -19,6 +19,7 @@
|
||||
from llnl.util.symlink import readlink
|
||||
|
||||
import spack.cmd.env
|
||||
import spack.concretize
|
||||
import spack.config
|
||||
import spack.environment as ev
|
||||
import spack.environment.depfile as depfile
|
||||
@ -914,7 +915,7 @@ def test_lockfile_spliced_specs(environment_from_manifest, install_mockery):
|
||||
"""Test that an environment can round-trip a spliced spec."""
|
||||
# Create a local install for zmpi to splice in
|
||||
# Default concretization is not using zmpi
|
||||
zmpi = spack.spec.Spec("zmpi").concretized()
|
||||
zmpi = spack.concretize.concretized(spack.spec.Spec("zmpi"))
|
||||
PackageInstaller([zmpi.package], fake=True).install()
|
||||
|
||||
e1 = environment_from_manifest(
|
||||
@ -1277,39 +1278,43 @@ def test_config_change_existing(mutable_mock_env_path, tmp_path, mock_packages,
|
||||
with e:
|
||||
# List of requirements, flip a variant
|
||||
config("change", "packages:mpich:require:~debug")
|
||||
test_spec = spack.spec.Spec("mpich").concretized()
|
||||
test_spec = spack.concretize.concretized(spack.spec.Spec("mpich"))
|
||||
assert test_spec.satisfies("@3.0.2~debug")
|
||||
|
||||
# List of requirements, change the version (in a different scope)
|
||||
config("change", "packages:mpich:require:@3.0.3")
|
||||
test_spec = spack.spec.Spec("mpich").concretized()
|
||||
test_spec = spack.concretize.concretized(spack.spec.Spec("mpich"))
|
||||
assert test_spec.satisfies("@3.0.3")
|
||||
|
||||
# "require:" as a single string, also try specifying
|
||||
# a spec string that requires enclosing in quotes as
|
||||
# part of the config path
|
||||
config("change", 'packages:libelf:require:"@0.8.12:"')
|
||||
spack.spec.Spec("libelf@0.8.12").concretized()
|
||||
spack.concretize.concretized(spack.spec.Spec("libelf@0.8.12"))
|
||||
# No need for assert, if there wasn't a failure, we
|
||||
# changed the requirement successfully.
|
||||
|
||||
# Use change to add a requirement for a package that
|
||||
# has no requirements defined
|
||||
config("change", "packages:fftw:require:+mpi")
|
||||
test_spec = spack.spec.Spec("fftw").concretized()
|
||||
test_spec = spack.concretize.concretized(spack.spec.Spec("fftw"))
|
||||
assert test_spec.satisfies("+mpi")
|
||||
config("change", "packages:fftw:require:~mpi")
|
||||
test_spec = spack.spec.Spec("fftw").concretized()
|
||||
test_spec = spack.concretize.concretized(spack.spec.Spec("fftw"))
|
||||
assert test_spec.satisfies("~mpi")
|
||||
config("change", "packages:fftw:require:@1.0")
|
||||
test_spec = spack.spec.Spec("fftw").concretized()
|
||||
test_spec = spack.concretize.concretized(spack.spec.Spec("fftw"))
|
||||
assert test_spec.satisfies("@1.0~mpi")
|
||||
|
||||
# Use "--match-spec" to change one spec in a "one_of"
|
||||
# list
|
||||
config("change", "packages:bowtie:require:@1.2.2", "--match-spec", "@1.2.0")
|
||||
spack.spec.Spec("bowtie@1.3.0").concretize()
|
||||
spack.spec.Spec("bowtie@1.2.2").concretized()
|
||||
# confirm that we can concretize to either value
|
||||
spack.concretize.concretized(spack.spec.Spec("bowtie@1.3.0"))
|
||||
spack.concretize.concretized(spack.spec.Spec("bowtie@1.2.2"))
|
||||
# confirm that we cannot concretize to the old value
|
||||
with pytest.raises(spack.solver.asp.UnsatisfiableSpecError):
|
||||
spack.concretize.concretized(spack.spec.Spec("bowtie@1.2.0"))
|
||||
|
||||
|
||||
def test_config_change_new(mutable_mock_env_path, tmp_path, mock_packages, mutable_config):
|
||||
@ -1324,8 +1329,8 @@ def test_config_change_new(mutable_mock_env_path, tmp_path, mock_packages, mutab
|
||||
with ev.Environment(tmp_path):
|
||||
config("change", "packages:mpich:require:~debug")
|
||||
with pytest.raises(spack.solver.asp.UnsatisfiableSpecError):
|
||||
spack.spec.Spec("mpich+debug").concretized()
|
||||
spack.spec.Spec("mpich~debug").concretized()
|
||||
spack.concretize.concretized(spack.spec.Spec("mpich+debug"))
|
||||
spack.concretize.concretized(spack.spec.Spec("mpich~debug"))
|
||||
|
||||
# Now check that we raise an error if we need to add a require: constraint
|
||||
# when preexisting config manually specified it as a singular spec
|
||||
@ -1339,7 +1344,7 @@ def test_config_change_new(mutable_mock_env_path, tmp_path, mock_packages, mutab
|
||||
"""
|
||||
)
|
||||
with ev.Environment(tmp_path):
|
||||
assert spack.spec.Spec("mpich").concretized().satisfies("@3.0.3")
|
||||
assert spack.concretize.concretized(spack.spec.Spec("mpich")).satisfies("@3.0.3")
|
||||
with pytest.raises(spack.error.ConfigError, match="not a list"):
|
||||
config("change", "packages:mpich:require:~debug")
|
||||
|
||||
@ -1647,7 +1652,7 @@ def test_stage(mock_stage, mock_fetch, install_mockery):
|
||||
root = str(mock_stage)
|
||||
|
||||
def check_stage(spec):
|
||||
spec = Spec(spec).concretized()
|
||||
spec = spack.concretize.concretized(Spec(spec))
|
||||
for dep in spec.traverse():
|
||||
stage_name = "{0}{1}-{2}-{3}".format(
|
||||
stage_prefix, dep.name, dep.version, dep.dag_hash()
|
||||
@ -1750,7 +1755,7 @@ def test_indirect_build_dep(tmp_path):
|
||||
|
||||
with spack.repo.use_repositories(builder.root):
|
||||
x_spec = Spec("x")
|
||||
x_concretized = x_spec.concretized()
|
||||
x_concretized = spack.concretize.concretized(x_spec)
|
||||
|
||||
_env_create("test", with_view=False)
|
||||
e = ev.read("test")
|
||||
@ -1783,10 +1788,10 @@ def test_store_different_build_deps(tmp_path):
|
||||
|
||||
with spack.repo.use_repositories(builder.root):
|
||||
y_spec = Spec("y ^z@3")
|
||||
y_concretized = y_spec.concretized()
|
||||
y_concretized = spack.concretize.concretized(y_spec)
|
||||
|
||||
x_spec = Spec("x ^z@2")
|
||||
x_concretized = x_spec.concretized()
|
||||
x_concretized = spack.concretize.concretized(x_spec)
|
||||
|
||||
# Even though x chose a different 'z', the y it chooses should be identical
|
||||
# *aside* from the dependency on 'z'. The dag_hash() will show the difference
|
||||
|
@ -6,6 +6,7 @@
|
||||
|
||||
import pytest
|
||||
|
||||
import spack.concretize
|
||||
from spack.installer import PackageInstaller
|
||||
from spack.main import SpackCommand, SpackCommandError
|
||||
from spack.spec import Spec
|
||||
@ -15,7 +16,9 @@
|
||||
|
||||
@pytest.fixture
|
||||
def python_database(mock_packages, mutable_database):
|
||||
specs = [Spec(s).concretized() for s in ["python", "py-extension1", "py-extension2"]]
|
||||
specs = [
|
||||
spack.concretize.concretized(Spec(s)) for s in ["python", "py-extension1", "py-extension2"]
|
||||
]
|
||||
PackageInstaller([s.package for s in specs], explicit=True, fake=True).install()
|
||||
yield
|
||||
|
||||
@ -23,7 +26,7 @@ def python_database(mock_packages, mutable_database):
|
||||
@pytest.mark.not_on_windows("All Fetchers Failed")
|
||||
@pytest.mark.db
|
||||
def test_extensions(mock_packages, python_database, capsys):
|
||||
ext2 = Spec("py-extension2").concretized()
|
||||
ext2 = spack.concretize.concretized(Spec("py-extension2"))
|
||||
|
||||
def check_output(ni):
|
||||
with capsys.disabled():
|
||||
|
@ -13,6 +13,7 @@
|
||||
|
||||
import spack.cmd as cmd
|
||||
import spack.cmd.find
|
||||
import spack.concretize
|
||||
import spack.environment as ev
|
||||
import spack.repo
|
||||
import spack.store
|
||||
@ -202,7 +203,8 @@ def test_find_json_deps(database):
|
||||
@pytest.mark.db
|
||||
def test_display_json(database, capsys):
|
||||
specs = [
|
||||
Spec(s).concretized() for s in ["mpileaks ^zmpi", "mpileaks ^mpich", "mpileaks ^mpich2"]
|
||||
spack.concretize.concretized(Spec(s))
|
||||
for s in ["mpileaks ^zmpi", "mpileaks ^mpich", "mpileaks ^mpich2"]
|
||||
]
|
||||
|
||||
cmd.display_specs_as_json(specs)
|
||||
@ -217,7 +219,8 @@ def test_display_json(database, capsys):
|
||||
@pytest.mark.db
|
||||
def test_display_json_deps(database, capsys):
|
||||
specs = [
|
||||
Spec(s).concretized() for s in ["mpileaks ^zmpi", "mpileaks ^mpich", "mpileaks ^mpich2"]
|
||||
spack.concretize.concretized(Spec(s))
|
||||
for s in ["mpileaks ^zmpi", "mpileaks ^mpich", "mpileaks ^mpich2"]
|
||||
]
|
||||
|
||||
cmd.display_specs_as_json(specs, deps=True)
|
||||
@ -276,7 +279,7 @@ def test_find_format_deps(database, config):
|
||||
def test_find_format_deps_paths(database, config):
|
||||
output = find("-dp", "--format", "{name}-{version}", "mpileaks", "^zmpi")
|
||||
|
||||
spec = Spec("mpileaks ^zmpi").concretized()
|
||||
spec = spack.concretize.concretized(Spec("mpileaks ^zmpi"))
|
||||
prefixes = [s.prefix for s in spec.traverse()]
|
||||
|
||||
assert (
|
||||
@ -301,7 +304,8 @@ def test_find_very_long(database, config):
|
||||
output = find("-L", "--no-groups", "mpileaks")
|
||||
|
||||
specs = [
|
||||
Spec(s).concretized() for s in ["mpileaks ^zmpi", "mpileaks ^mpich", "mpileaks ^mpich2"]
|
||||
spack.concretize.concretized(Spec(s))
|
||||
for s in ["mpileaks ^zmpi", "mpileaks ^mpich", "mpileaks ^mpich2"]
|
||||
]
|
||||
|
||||
assert set(output.strip().split("\n")) == set(
|
||||
|
@ -6,6 +6,7 @@
|
||||
|
||||
import pytest
|
||||
|
||||
import spack.concretize
|
||||
import spack.deptypes as dt
|
||||
import spack.environment as ev
|
||||
import spack.main
|
||||
@ -26,8 +27,7 @@ def test_gc_without_build_dependency(mutable_database):
|
||||
|
||||
@pytest.mark.db
|
||||
def test_gc_with_build_dependency(mutable_database):
|
||||
s = spack.spec.Spec("simple-inheritance")
|
||||
s.concretize()
|
||||
s = spack.concretize.concretized(spack.spec.Spec("simple-inheritance"))
|
||||
PackageInstaller([s.package], explicit=True, fake=True).install()
|
||||
|
||||
assert "There are no unused specs." in gc("-yb")
|
||||
@ -37,8 +37,8 @@ def test_gc_with_build_dependency(mutable_database):
|
||||
|
||||
@pytest.mark.db
|
||||
def test_gc_with_constraints(mutable_database):
|
||||
s_cmake1 = spack.spec.Spec("simple-inheritance ^cmake@3.4.3").concretized()
|
||||
s_cmake2 = spack.spec.Spec("simple-inheritance ^cmake@3.23.1").concretized()
|
||||
s_cmake1 = spack.concretize.concretized(spack.spec.Spec("simple-inheritance ^cmake@3.4.3"))
|
||||
s_cmake2 = spack.concretize.concretized(spack.spec.Spec("simple-inheritance ^cmake@3.23.1"))
|
||||
PackageInstaller([s_cmake1.package], explicit=True, fake=True).install()
|
||||
PackageInstaller([s_cmake2.package], explicit=True, fake=True).install()
|
||||
|
||||
@ -53,8 +53,7 @@ def test_gc_with_constraints(mutable_database):
|
||||
|
||||
@pytest.mark.db
|
||||
def test_gc_with_environment(mutable_database, mutable_mock_env_path):
|
||||
s = spack.spec.Spec("simple-inheritance")
|
||||
s.concretize()
|
||||
s = spack.concretize.concretized(spack.spec.Spec("simple-inheritance"))
|
||||
PackageInstaller([s.package], explicit=True, fake=True).install()
|
||||
|
||||
e = ev.create("test_gc")
|
||||
@ -69,8 +68,7 @@ def test_gc_with_environment(mutable_database, mutable_mock_env_path):
|
||||
|
||||
@pytest.mark.db
|
||||
def test_gc_with_build_dependency_in_environment(mutable_database, mutable_mock_env_path):
|
||||
s = spack.spec.Spec("simple-inheritance")
|
||||
s.concretize()
|
||||
s = spack.concretize.concretized(spack.spec.Spec("simple-inheritance"))
|
||||
PackageInstaller([s.package], explicit=True, fake=True).install()
|
||||
|
||||
e = ev.create("test_gc")
|
||||
@ -121,8 +119,7 @@ def test_gc_except_any_environments(mutable_database, mutable_mock_env_path):
|
||||
|
||||
@pytest.mark.db
|
||||
def test_gc_except_specific_environments(mutable_database, mutable_mock_env_path):
|
||||
s = spack.spec.Spec("simple-inheritance")
|
||||
s.concretize()
|
||||
s = spack.concretize.concretized(spack.spec.Spec("simple-inheritance"))
|
||||
PackageInstaller([s.package], explicit=True, fake=True).install()
|
||||
|
||||
assert mutable_database.query_local("zmpi")
|
||||
@ -148,8 +145,7 @@ def test_gc_except_nonexisting_dir_env(mutable_database, mutable_mock_env_path,
|
||||
|
||||
@pytest.mark.db
|
||||
def test_gc_except_specific_dir_env(mutable_database, mutable_mock_env_path, tmpdir):
|
||||
s = spack.spec.Spec("simple-inheritance")
|
||||
s.concretize()
|
||||
s = spack.concretize.concretized(spack.spec.Spec("simple-inheritance"))
|
||||
PackageInstaller([s.package], explicit=True, fake=True).install()
|
||||
|
||||
assert mutable_database.query_local("zmpi")
|
||||
|
@ -20,6 +20,7 @@
|
||||
import spack.build_environment
|
||||
import spack.cmd.common.arguments
|
||||
import spack.cmd.install
|
||||
import spack.concretize
|
||||
import spack.config
|
||||
import spack.environment as ev
|
||||
import spack.error
|
||||
@ -135,7 +136,7 @@ def test_package_output(tmpdir, capsys, install_mockery, mock_fetch):
|
||||
# we can't use output capture here because it interferes with Spack's
|
||||
# logging. TODO: see whether we can get multiple log_outputs to work
|
||||
# when nested AND in pytest
|
||||
spec = Spec("printing-package").concretized()
|
||||
spec = spack.concretize.concretized(Spec("printing-package"))
|
||||
pkg = spec.package
|
||||
PackageInstaller([pkg], explicit=True, verbose=True).install()
|
||||
|
||||
@ -175,7 +176,7 @@ def test_install_output_on_python_error(mock_packages, mock_archive, mock_fetch,
|
||||
def test_install_with_source(mock_packages, mock_archive, mock_fetch, install_mockery):
|
||||
"""Verify that source has been copied into place."""
|
||||
install("--source", "--keep-stage", "trivial-install-test-package")
|
||||
spec = Spec("trivial-install-test-package").concretized()
|
||||
spec = spack.concretize.concretized(Spec("trivial-install-test-package"))
|
||||
src = os.path.join(spec.prefix.share, "trivial-install-test-package", "src")
|
||||
assert filecmp.cmp(
|
||||
os.path.join(mock_archive.path, "configure"), os.path.join(src, "configure")
|
||||
@ -183,8 +184,7 @@ def test_install_with_source(mock_packages, mock_archive, mock_fetch, install_mo
|
||||
|
||||
|
||||
def test_install_env_variables(mock_packages, mock_archive, mock_fetch, install_mockery):
|
||||
spec = Spec("libdwarf")
|
||||
spec.concretize()
|
||||
spec = spack.concretize.concretized(Spec("libdwarf"))
|
||||
install("libdwarf")
|
||||
assert os.path.isfile(spec.package.install_env_path)
|
||||
|
||||
@ -205,8 +205,7 @@ def test_show_log_on_error(mock_packages, mock_archive, mock_fetch, install_mock
|
||||
|
||||
def test_install_overwrite(mock_packages, mock_archive, mock_fetch, install_mockery):
|
||||
# Try to install a spec and then to reinstall it.
|
||||
spec = Spec("libdwarf")
|
||||
spec.concretize()
|
||||
spec = spack.concretize.concretized(Spec("libdwarf"))
|
||||
|
||||
install("libdwarf")
|
||||
|
||||
@ -239,8 +238,7 @@ def test_install_overwrite(mock_packages, mock_archive, mock_fetch, install_mock
|
||||
|
||||
def test_install_overwrite_not_installed(mock_packages, mock_archive, mock_fetch, install_mockery):
|
||||
# Try to install a spec and then to reinstall it.
|
||||
spec = Spec("libdwarf")
|
||||
spec.concretize()
|
||||
spec = spack.concretize.concretized(Spec("libdwarf"))
|
||||
|
||||
assert not os.path.exists(spec.prefix)
|
||||
|
||||
@ -261,7 +259,7 @@ def test_install_commit(mock_git_version_info, install_mockery, mock_packages, m
|
||||
monkeypatch.setattr(spack.package_base.PackageBase, "git", file_url, raising=False)
|
||||
|
||||
# Use the earliest commit in the respository
|
||||
spec = Spec(f"git-test-commit@{commits[-1]}").concretized()
|
||||
spec = spack.concretize.concretized(Spec(f"git-test-commit@{commits[-1]}"))
|
||||
PackageInstaller([spec.package], explicit=True).install()
|
||||
|
||||
# Ensure first commit file contents were written
|
||||
@ -274,13 +272,11 @@ def test_install_commit(mock_git_version_info, install_mockery, mock_packages, m
|
||||
|
||||
def test_install_overwrite_multiple(mock_packages, mock_archive, mock_fetch, install_mockery):
|
||||
# Try to install a spec and then to reinstall it.
|
||||
libdwarf = Spec("libdwarf")
|
||||
libdwarf.concretize()
|
||||
libdwarf = spack.concretize.concretized(Spec("libdwarf"))
|
||||
|
||||
install("libdwarf")
|
||||
|
||||
cmake = Spec("cmake")
|
||||
cmake.concretize()
|
||||
cmake = spack.concretize.concretized(Spec("cmake"))
|
||||
|
||||
install("cmake")
|
||||
|
||||
@ -356,7 +352,7 @@ def test_install_invalid_spec(invalid_spec):
|
||||
)
|
||||
def test_install_from_file(spec, concretize, error_code, tmpdir):
|
||||
if concretize:
|
||||
spec.concretize()
|
||||
spec = spack.concretize.concretized(spec)
|
||||
|
||||
specfile = tmpdir.join("spec.yaml")
|
||||
|
||||
@ -486,8 +482,7 @@ def test_install_mix_cli_and_files(clispecs, filespecs, tmpdir):
|
||||
for spec in filespecs:
|
||||
filepath = tmpdir.join(spec + ".yaml")
|
||||
args = ["-f", str(filepath)] + args
|
||||
s = Spec(spec)
|
||||
s.concretize()
|
||||
s = spack.concretize.concretized(Spec(spec))
|
||||
with filepath.open("w") as f:
|
||||
s.to_yaml(f)
|
||||
|
||||
@ -496,8 +491,7 @@ def test_install_mix_cli_and_files(clispecs, filespecs, tmpdir):
|
||||
|
||||
|
||||
def test_extra_files_are_archived(mock_packages, mock_archive, mock_fetch, install_mockery):
|
||||
s = Spec("archive-files")
|
||||
s.concretize()
|
||||
s = spack.concretize.concretized(Spec("archive-files"))
|
||||
|
||||
install("archive-files")
|
||||
|
||||
@ -616,8 +610,7 @@ def test_cdash_install_from_spec_json(
|
||||
with capfd.disabled(), tmpdir.as_cwd():
|
||||
spec_json_path = str(tmpdir.join("spec.json"))
|
||||
|
||||
pkg_spec = Spec("pkg-a")
|
||||
pkg_spec.concretize()
|
||||
pkg_spec = spack.concretize.concretized(Spec("pkg-a"))
|
||||
|
||||
with open(spec_json_path, "w") as fd:
|
||||
fd.write(pkg_spec.to_json(hash=ht.dag_hash))
|
||||
@ -693,8 +686,8 @@ def test_cache_only_fails(tmpdir, mock_fetch, install_mockery, capfd):
|
||||
|
||||
|
||||
def test_install_only_dependencies(tmpdir, mock_fetch, install_mockery):
|
||||
dep = Spec("dependency-install").concretized()
|
||||
root = Spec("dependent-install").concretized()
|
||||
dep = spack.concretize.concretized(Spec("dependency-install"))
|
||||
root = spack.concretize.concretized(Spec("dependent-install"))
|
||||
|
||||
install("--only", "dependencies", "dependent-install")
|
||||
|
||||
@ -715,8 +708,8 @@ def test_install_only_package(tmpdir, mock_fetch, install_mockery, capfd):
|
||||
|
||||
|
||||
def test_install_deps_then_package(tmpdir, mock_fetch, install_mockery):
|
||||
dep = Spec("dependency-install").concretized()
|
||||
root = Spec("dependent-install").concretized()
|
||||
dep = spack.concretize.concretized(Spec("dependency-install"))
|
||||
root = spack.concretize.concretized(Spec("dependent-install"))
|
||||
|
||||
install("--only", "dependencies", "dependent-install")
|
||||
assert os.path.exists(dep.prefix)
|
||||
@ -734,8 +727,8 @@ def test_install_only_dependencies_in_env(
|
||||
env("create", "test")
|
||||
|
||||
with ev.read("test"):
|
||||
dep = Spec("dependency-install").concretized()
|
||||
root = Spec("dependent-install").concretized()
|
||||
dep = spack.concretize.concretized(Spec("dependency-install"))
|
||||
root = spack.concretize.concretized(Spec("dependent-install"))
|
||||
|
||||
install("-v", "--only", "dependencies", "--add", "dependent-install")
|
||||
|
||||
@ -751,8 +744,8 @@ def test_install_only_dependencies_of_all_in_env(
|
||||
|
||||
with ev.read("test"):
|
||||
roots = [
|
||||
Spec("dependent-install@1.0").concretized(),
|
||||
Spec("dependent-install@2.0").concretized(),
|
||||
spack.concretize.concretized(Spec("dependent-install@1.0")),
|
||||
spack.concretize.concretized(Spec("dependent-install@2.0")),
|
||||
]
|
||||
|
||||
add("dependent-install@1.0")
|
||||
@ -901,7 +894,7 @@ def test_cdash_configure_warning(tmpdir, mock_fetch, install_mockery, capfd):
|
||||
|
||||
# Ensure that even on non-x86_64 architectures, there are no
|
||||
# dependencies installed
|
||||
spec = Spec("configure-warning").concretized()
|
||||
spec = spack.concretize.concretized(Spec("configure-warning"))
|
||||
spec.clear_dependencies()
|
||||
specfile = "./spec.json"
|
||||
with open(specfile, "w") as f:
|
||||
@ -947,7 +940,7 @@ def test_install_env_with_tests_all(
|
||||
):
|
||||
env("create", "test")
|
||||
with ev.read("test"):
|
||||
test_dep = Spec("test-dependency").concretized()
|
||||
test_dep = spack.concretize.concretized(Spec("test-dependency"))
|
||||
add("depb")
|
||||
install("--test", "all")
|
||||
assert os.path.exists(test_dep.prefix)
|
||||
@ -959,7 +952,7 @@ def test_install_env_with_tests_root(
|
||||
):
|
||||
env("create", "test")
|
||||
with ev.read("test"):
|
||||
test_dep = Spec("test-dependency").concretized()
|
||||
test_dep = spack.concretize.concretized(Spec("test-dependency"))
|
||||
add("depb")
|
||||
install("--test", "root")
|
||||
assert not os.path.exists(test_dep.prefix)
|
||||
|
@ -8,6 +8,7 @@
|
||||
|
||||
import pytest
|
||||
|
||||
import spack.concretize
|
||||
import spack.spec
|
||||
import spack.user_environment as uenv
|
||||
from spack.main import SpackCommand
|
||||
@ -50,7 +51,7 @@ def test_load_shell(shell, set_command):
|
||||
"""Test that `spack load` applies prefix inspections of its required runtime deps in
|
||||
topo-order"""
|
||||
install("mpileaks")
|
||||
mpileaks_spec = spack.spec.Spec("mpileaks").concretized()
|
||||
mpileaks_spec = spack.concretize.concretized(spack.spec.Spec("mpileaks"))
|
||||
|
||||
# Ensure our reference variable is clean.
|
||||
os.environ["CMAKE_PREFIX_PATH"] = "/hello" + os.pathsep + "/world"
|
||||
@ -167,7 +168,7 @@ def test_unload(
|
||||
"""Tests that any variables set in the user environment are undone by the
|
||||
unload command"""
|
||||
install("mpileaks")
|
||||
mpileaks_spec = spack.spec.Spec("mpileaks").concretized()
|
||||
mpileaks_spec = spack.concretize.concretized(spack.spec.Spec("mpileaks"))
|
||||
|
||||
# Set so unload has something to do
|
||||
os.environ["FOOBAR"] = "mpileaks"
|
||||
@ -188,7 +189,7 @@ def test_unload_fails_no_shell(
|
||||
):
|
||||
"""Test that spack unload prints an error message without a shell."""
|
||||
install("mpileaks")
|
||||
mpileaks_spec = spack.spec.Spec("mpileaks").concretized()
|
||||
mpileaks_spec = spack.concretize.concretized(spack.spec.Spec("mpileaks"))
|
||||
os.environ[uenv.spack_loaded_hashes_var] = mpileaks_spec.dag_hash()
|
||||
|
||||
out = unload("mpileaks", fail_on_error=False)
|
||||
|
@ -9,6 +9,7 @@
|
||||
|
||||
from llnl.util.filesystem import mkdirp
|
||||
|
||||
import spack.concretize
|
||||
import spack.environment as ev
|
||||
import spack.paths
|
||||
import spack.spec
|
||||
@ -26,7 +27,7 @@
|
||||
@pytest.fixture
|
||||
def mock_spec():
|
||||
# Make it look like the source was actually expanded.
|
||||
s = spack.spec.Spec("externaltest").concretized()
|
||||
s = spack.concretize.concretized(spack.spec.Spec("externaltest"))
|
||||
source_path = s.package.stage.source_path
|
||||
mkdirp(source_path)
|
||||
yield s, s.package
|
||||
|
@ -14,6 +14,7 @@
|
||||
|
||||
import spack
|
||||
import spack.cmd.logs
|
||||
import spack.concretize
|
||||
import spack.main
|
||||
import spack.spec
|
||||
from spack.main import SpackCommand
|
||||
@ -54,7 +55,7 @@ def disable_capture(capfd):
|
||||
|
||||
|
||||
def test_logs_cmd_errors(install_mockery, mock_fetch, mock_archive, mock_packages):
|
||||
spec = spack.spec.Spec("libelf").concretized()
|
||||
spec = spack.concretize.concretized(spack.spec.Spec("libelf"))
|
||||
assert not spec.installed
|
||||
|
||||
with pytest.raises(spack.main.SpackCommandError, match="is not installed or staged"):
|
||||
@ -83,7 +84,7 @@ def test_dump_logs(install_mockery, mock_fetch, mock_archive, mock_packages, dis
|
||||
decompress them.
|
||||
"""
|
||||
cmdline_spec = spack.spec.Spec("libelf")
|
||||
concrete_spec = cmdline_spec.concretized()
|
||||
concrete_spec = spack.concretize.concretized(cmdline_spec)
|
||||
|
||||
# Sanity check, make sure this test is checking what we want: to
|
||||
# start with
|
||||
|
@ -8,6 +8,7 @@
|
||||
import pytest
|
||||
|
||||
import spack.cmd.mirror
|
||||
import spack.concretize
|
||||
import spack.config
|
||||
import spack.environment as ev
|
||||
import spack.error
|
||||
@ -61,7 +62,7 @@ def test_mirror_from_env(tmp_path, mock_packages, mock_fetch, mutable_mock_env_p
|
||||
|
||||
@pytest.fixture
|
||||
def source_for_pkg_with_hash(mock_packages, tmpdir):
|
||||
s = spack.spec.Spec("trivial-pkg-with-valid-hash").concretized()
|
||||
s = spack.concretize.concretized(spack.spec.Spec("trivial-pkg-with-valid-hash"))
|
||||
local_url_basename = os.path.basename(s.package.url)
|
||||
local_path = os.path.join(str(tmpdir), local_url_basename)
|
||||
with open(local_path, "w") as f:
|
||||
@ -73,7 +74,10 @@ def source_for_pkg_with_hash(mock_packages, tmpdir):
|
||||
def test_mirror_skip_unstable(tmpdir_factory, mock_packages, config, source_for_pkg_with_hash):
|
||||
mirror_dir = str(tmpdir_factory.mktemp("mirror-dir"))
|
||||
|
||||
specs = [spack.spec.Spec(x).concretized() for x in ["git-test", "trivial-pkg-with-valid-hash"]]
|
||||
specs = [
|
||||
spack.concretize.concretized(spack.spec.Spec(x))
|
||||
for x in ["git-test", "trivial-pkg-with-valid-hash"]
|
||||
]
|
||||
spack.mirrors.utils.create(mirror_dir, specs, skip_unstable_versions=True)
|
||||
|
||||
assert set(os.listdir(mirror_dir)) - set(["_source-cache"]) == set(
|
||||
@ -112,7 +116,8 @@ def test_exclude_specs(mock_packages, config):
|
||||
|
||||
mirror_specs, _ = spack.cmd.mirror._specs_and_action(args)
|
||||
expected_include = set(
|
||||
spack.spec.Spec(x).concretized() for x in ["mpich@3.0.3", "mpich@3.0.4", "mpich@3.0"]
|
||||
spack.concretize.concretized(spack.spec.Spec(x))
|
||||
for x in ["mpich@3.0.3", "mpich@3.0.4", "mpich@3.0"]
|
||||
)
|
||||
expected_exclude = set(spack.spec.Spec(x) for x in ["mpich@3.0.1", "mpich@3.0.2", "mpich@1.0"])
|
||||
assert expected_include <= set(mirror_specs)
|
||||
@ -146,7 +151,8 @@ def test_exclude_file(mock_packages, tmpdir, config):
|
||||
|
||||
mirror_specs, _ = spack.cmd.mirror._specs_and_action(args)
|
||||
expected_include = set(
|
||||
spack.spec.Spec(x).concretized() for x in ["mpich@3.0.3", "mpich@3.0.4", "mpich@3.0"]
|
||||
spack.concretize.concretized(spack.spec.Spec(x))
|
||||
for x in ["mpich@3.0.3", "mpich@3.0.4", "mpich@3.0"]
|
||||
)
|
||||
expected_exclude = set(spack.spec.Spec(x) for x in ["mpich@3.0.1", "mpich@3.0.2", "mpich@1.0"])
|
||||
assert expected_include <= set(mirror_specs)
|
||||
|
@ -8,6 +8,7 @@
|
||||
|
||||
import pytest
|
||||
|
||||
import spack.concretize
|
||||
import spack.config
|
||||
import spack.main
|
||||
import spack.modules
|
||||
@ -34,7 +35,7 @@ def ensure_module_files_are_there(mock_repo_path, mock_store, mock_configuration
|
||||
|
||||
|
||||
def _module_files(module_type, *specs):
|
||||
specs = [spack.spec.Spec(x).concretized() for x in specs]
|
||||
specs = [spack.concretize.concretized(spack.spec.Spec(x)) for x in specs]
|
||||
writer_cls = spack.modules.module_types[module_type]
|
||||
return [writer_cls(spec, "default").layout.filename for spec in specs]
|
||||
|
||||
@ -185,12 +186,15 @@ def test_setdefault_command(mutable_database, mutable_config):
|
||||
# Install two different versions of pkg-a
|
||||
other_spec, preferred = "pkg-a@1.0", "pkg-a@2.0"
|
||||
|
||||
specs = [spack.spec.Spec(other_spec).concretized(), spack.spec.Spec(preferred).concretized()]
|
||||
specs = [
|
||||
spack.concretize.concretized(spack.spec.Spec(other_spec)),
|
||||
spack.concretize.concretized(spack.spec.Spec(preferred)),
|
||||
]
|
||||
PackageInstaller([s.package for s in specs], explicit=True, fake=True).install()
|
||||
|
||||
writers = {
|
||||
preferred: writer_cls(spack.spec.Spec(preferred).concretized(), "default"),
|
||||
other_spec: writer_cls(spack.spec.Spec(other_spec).concretized(), "default"),
|
||||
preferred: writer_cls(specs[1], "default"),
|
||||
other_spec: writer_cls(specs[0], "default"),
|
||||
}
|
||||
|
||||
# Create two module files for the same software
|
||||
|
@ -3,6 +3,7 @@
|
||||
#
|
||||
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
|
||||
|
||||
import spack.concretize
|
||||
import spack.main
|
||||
import spack.repo
|
||||
import spack.spec
|
||||
@ -48,7 +49,7 @@ class tag_path:
|
||||
|
||||
|
||||
def test_tags_installed(install_mockery, mock_fetch):
|
||||
s = spack.spec.Spec("mpich").concretized()
|
||||
s = spack.concretize.concretized(spack.spec.Spec("mpich"))
|
||||
PackageInstaller([s.package], explicit=True, fake=True).install()
|
||||
|
||||
out = tags("-i")
|
||||
|
@ -12,6 +12,7 @@
|
||||
|
||||
import spack.cmd.common.arguments
|
||||
import spack.cmd.test
|
||||
import spack.concretize
|
||||
import spack.config
|
||||
import spack.install_test
|
||||
import spack.paths
|
||||
@ -241,7 +242,7 @@ def test_read_old_results(mock_packages, mock_test_stage):
|
||||
|
||||
def test_test_results_none(mock_packages, mock_test_stage):
|
||||
name = "trivial"
|
||||
spec = spack.spec.Spec("trivial-smoke-test").concretized()
|
||||
spec = spack.concretize.concretized(spack.spec.Spec("trivial-smoke-test"))
|
||||
suite = spack.install_test.TestSuite([spec], name)
|
||||
suite.ensure_stage()
|
||||
spack.install_test.write_test_suite_file(suite)
|
||||
@ -256,7 +257,7 @@ def test_test_results_none(mock_packages, mock_test_stage):
|
||||
def test_test_results_status(mock_packages, mock_test_stage, status):
|
||||
"""Confirm 'spack test results' returns expected status."""
|
||||
name = "trivial"
|
||||
spec = spack.spec.Spec("trivial-smoke-test").concretized()
|
||||
spec = spack.concretize.concretized(spack.spec.Spec("trivial-smoke-test"))
|
||||
suite = spack.install_test.TestSuite([spec], name)
|
||||
suite.ensure_stage()
|
||||
spack.install_test.write_test_suite_file(suite)
|
||||
@ -279,7 +280,7 @@ def test_test_results_status(mock_packages, mock_test_stage, status):
|
||||
def test_report_filename_for_cdash(install_mockery, mock_fetch):
|
||||
"""Test that the temporary file used to write Testing.xml for CDash is not the upload URL"""
|
||||
name = "trivial"
|
||||
spec = spack.spec.Spec("trivial-smoke-test").concretized()
|
||||
spec = spack.concretize.concretized(spack.spec.Spec("trivial-smoke-test"))
|
||||
suite = spack.install_test.TestSuite([spec], name)
|
||||
suite.ensure_stage()
|
||||
|
||||
|
@ -2,6 +2,7 @@
|
||||
# Spack Project Developers. See the top-level COPYRIGHT file for details.
|
||||
#
|
||||
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
|
||||
import spack.concretize
|
||||
import spack.environment as ev
|
||||
import spack.spec
|
||||
from spack.main import SpackCommand
|
||||
@ -31,9 +32,9 @@ def test_undevelop(tmpdir, mutable_config, mock_packages, mutable_mock_env_path)
|
||||
|
||||
env("create", "test", "./spack.yaml")
|
||||
with ev.read("test"):
|
||||
before = spack.spec.Spec("mpich").concretized()
|
||||
before = spack.concretize.concretized(spack.spec.Spec("mpich"))
|
||||
undevelop("mpich")
|
||||
after = spack.spec.Spec("mpich").concretized()
|
||||
after = spack.concretize.concretized(spack.spec.Spec("mpich"))
|
||||
|
||||
# Removing dev spec from environment changes concretization
|
||||
assert before.satisfies("dev_path=*")
|
||||
|
@ -8,6 +8,7 @@
|
||||
|
||||
import llnl.util.filesystem as fs
|
||||
|
||||
import spack.concretize
|
||||
import spack.spec
|
||||
import spack.store
|
||||
import spack.util.spack_json as sjson
|
||||
@ -66,7 +67,7 @@ def test_single_file_verify_cmd(tmpdir):
|
||||
def test_single_spec_verify_cmd(tmpdir, mock_packages, mock_archive, mock_fetch, install_mockery):
|
||||
# Test the verify command interface to verify a single spec
|
||||
install("libelf")
|
||||
s = spack.spec.Spec("libelf").concretized()
|
||||
s = spack.concretize.concretized(spack.spec.Spec("libelf"))
|
||||
prefix = s.prefix
|
||||
hash = s.dag_hash()
|
||||
|
||||
|
@ -10,6 +10,7 @@
|
||||
|
||||
from llnl.util.symlink import _windows_can_symlink
|
||||
|
||||
import spack.concretize
|
||||
import spack.util.spack_yaml as s_yaml
|
||||
from spack.installer import PackageInstaller
|
||||
from spack.main import SpackCommand
|
||||
@ -191,7 +192,7 @@ def test_view_fails_with_missing_projections_file(tmpdir):
|
||||
def test_view_files_not_ignored(
|
||||
tmpdir, mock_packages, mock_archive, mock_fetch, install_mockery, cmd, with_projection
|
||||
):
|
||||
spec = Spec("view-not-ignored").concretized()
|
||||
spec = spack.concretize.concretized(Spec("view-not-ignored"))
|
||||
pkg = spec.package
|
||||
PackageInstaller([pkg], explicit=True).install()
|
||||
pkg.assert_installed(spec.prefix)
|
||||
|
@ -9,6 +9,7 @@
|
||||
|
||||
import archspec.cpu
|
||||
|
||||
import spack.concretize
|
||||
import spack.config
|
||||
import spack.paths
|
||||
import spack.repo
|
||||
@ -21,7 +22,7 @@
|
||||
|
||||
|
||||
def _concretize_with_reuse(*, root_str, reused_str):
|
||||
reused_spec = spack.spec.Spec(reused_str).concretized()
|
||||
reused_spec = spack.concretize.concretized(spack.spec.Spec(reused_str))
|
||||
setup = spack.solver.asp.SpackSolverSetup(tests=False)
|
||||
driver = spack.solver.asp.PyclingoDriver()
|
||||
result, _, _ = driver.solve(setup, [spack.spec.Spec(f"{root_str}")], reuse=[reused_spec])
|
||||
@ -45,7 +46,7 @@ def enable_runtimes():
|
||||
|
||||
|
||||
def test_correct_gcc_runtime_is_injected_as_dependency(runtime_repo):
|
||||
s = spack.spec.Spec("pkg-a%gcc@10.2.1 ^pkg-b%gcc@9.4.0").concretized()
|
||||
s = spack.concretize.concretized(spack.spec.Spec("pkg-a%gcc@10.2.1 ^pkg-b%gcc@9.4.0"))
|
||||
a, b = s["pkg-a"], s["pkg-b"]
|
||||
|
||||
# Both a and b should depend on the same gcc-runtime directly
|
||||
@ -62,7 +63,7 @@ def test_external_nodes_do_not_have_runtimes(runtime_repo, mutable_config, tmp_p
|
||||
packages_yaml = {"pkg-b": {"externals": [{"spec": "pkg-b@1.0", "prefix": f"{str(tmp_path)}"}]}}
|
||||
spack.config.set("packages", packages_yaml)
|
||||
|
||||
s = spack.spec.Spec("pkg-a%gcc@10.2.1").concretized()
|
||||
s = spack.concretize.concretized(spack.spec.Spec("pkg-a%gcc@10.2.1"))
|
||||
|
||||
a, b = s["pkg-a"], s["pkg-b"]
|
||||
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -5,6 +5,7 @@
|
||||
|
||||
import pytest
|
||||
|
||||
import spack.concretize
|
||||
import spack.config
|
||||
import spack.solver.asp
|
||||
import spack.spec
|
||||
@ -58,7 +59,7 @@ def test_error_messages(error_messages, config_set, spec, mock_packages, mutable
|
||||
spack.config.set(path, conf)
|
||||
|
||||
with pytest.raises(spack.solver.asp.UnsatisfiableSpecError) as e:
|
||||
_ = spack.spec.Spec(spec).concretized()
|
||||
_ = spack.concretize.concretized(spack.spec.Spec(spec))
|
||||
|
||||
for em in error_messages:
|
||||
assert em in str(e.value)
|
||||
|
@ -6,6 +6,7 @@
|
||||
|
||||
import pytest
|
||||
|
||||
import spack.concretize
|
||||
import spack.config
|
||||
import spack.environment as ev
|
||||
import spack.paths
|
||||
@ -63,12 +64,12 @@ def test_mix_spec_and_requirements(concretize_scope, test_repo):
|
||||
"""
|
||||
update_concretize_scope(conf_str, "packages")
|
||||
|
||||
s1 = Spec('y cflags="-a"').concretized()
|
||||
s1 = spack.concretize.concretized(Spec('y cflags="-a"'))
|
||||
assert s1.satisfies('cflags="-a -c"')
|
||||
|
||||
|
||||
def test_mix_spec_and_dependent(concretize_scope, test_repo):
|
||||
s1 = Spec('x ^y cflags="-a"').concretized()
|
||||
s1 = spack.concretize.concretized(Spec('x ^y cflags="-a"'))
|
||||
assert s1["y"].satisfies('cflags="-a -d1"')
|
||||
|
||||
|
||||
@ -93,7 +94,7 @@ def test_mix_spec_and_compiler_cfg(concretize_scope, test_repo):
|
||||
conf_str = _compiler_cfg_one_entry_with_cflags("-Wall")
|
||||
update_concretize_scope(conf_str, "compilers")
|
||||
|
||||
s1 = Spec('y %gcc@12.100.100 cflags="-O2"').concretized()
|
||||
s1 = spack.concretize.concretized(Spec('y %gcc@12.100.100 cflags="-O2"'))
|
||||
assert s1.satisfies('cflags="-Wall -O2"')
|
||||
|
||||
|
||||
@ -148,7 +149,7 @@ def test_flag_order_and_grouping(
|
||||
if cmd_flags:
|
||||
spec_str += f' cflags="{cmd_flags}"'
|
||||
|
||||
root_spec = Spec(spec_str).concretized()
|
||||
root_spec = spack.concretize.concretized(Spec(spec_str))
|
||||
spec = root_spec["y"]
|
||||
satisfy_flags = " ".join(x for x in [cmd_flags, req_flags, cmp_flags, expected_dflags] if x)
|
||||
assert spec.satisfies(f'cflags="{satisfy_flags}"')
|
||||
@ -156,11 +157,11 @@ def test_flag_order_and_grouping(
|
||||
|
||||
|
||||
def test_two_dependents_flag_mixing(concretize_scope, test_repo):
|
||||
root_spec1 = Spec("w~moveflaglater").concretized()
|
||||
root_spec1 = spack.concretize.concretized(Spec("w~moveflaglater"))
|
||||
spec1 = root_spec1["y"]
|
||||
assert spec1.compiler_flags["cflags"] == "-d0 -d1 -d2".split()
|
||||
|
||||
root_spec2 = Spec("w+moveflaglater").concretized()
|
||||
root_spec2 = spack.concretize.concretized(Spec("w+moveflaglater"))
|
||||
spec2 = root_spec2["y"]
|
||||
assert spec2.compiler_flags["cflags"] == "-d3 -d1 -d2".split()
|
||||
|
||||
@ -169,7 +170,7 @@ def test_propagate_and_compiler_cfg(concretize_scope, test_repo):
|
||||
conf_str = _compiler_cfg_one_entry_with_cflags("-f2")
|
||||
update_concretize_scope(conf_str, "compilers")
|
||||
|
||||
root_spec = Spec("v %gcc@12.100.100 cflags=='-f1'").concretized()
|
||||
root_spec = spack.concretize.concretized(Spec("v %gcc@12.100.100 cflags=='-f1'"))
|
||||
assert root_spec["y"].satisfies("cflags='-f1 -f2'")
|
||||
|
||||
|
||||
@ -178,7 +179,7 @@ def test_propagate_and_compiler_cfg(concretize_scope, test_repo):
|
||||
|
||||
|
||||
def test_propagate_and_pkg_dep(concretize_scope, test_repo):
|
||||
root_spec1 = Spec("x ~activatemultiflag cflags=='-f1'").concretized()
|
||||
root_spec1 = spack.concretize.concretized(Spec("x ~activatemultiflag cflags=='-f1'"))
|
||||
assert root_spec1["y"].satisfies("cflags='-f1 -d1'")
|
||||
|
||||
|
||||
@ -190,7 +191,7 @@ def test_propagate_and_require(concretize_scope, test_repo):
|
||||
"""
|
||||
update_concretize_scope(conf_str, "packages")
|
||||
|
||||
root_spec1 = Spec("v cflags=='-f1'").concretized()
|
||||
root_spec1 = spack.concretize.concretized(Spec("v cflags=='-f1'"))
|
||||
assert root_spec1["y"].satisfies("cflags='-f1 -f2'")
|
||||
|
||||
# Next, check that a requirement does not "undo" a request for
|
||||
@ -202,7 +203,7 @@ def test_propagate_and_require(concretize_scope, test_repo):
|
||||
"""
|
||||
update_concretize_scope(conf_str, "packages")
|
||||
|
||||
root_spec2 = Spec("v cflags=='-f1'").concretized()
|
||||
root_spec2 = spack.concretize.concretized(Spec("v cflags=='-f1'"))
|
||||
assert root_spec2["y"].satisfies("cflags='-f1'")
|
||||
|
||||
# Note: requirements cannot enforce propagation: any attempt to do
|
||||
@ -246,7 +247,7 @@ def test_diamond_dep_flag_mixing(concretize_scope, test_repo):
|
||||
nodes of the diamond always appear in the same order).
|
||||
`Spec.traverse` is responsible for handling both of these needs.
|
||||
"""
|
||||
root_spec1 = Spec("t").concretized()
|
||||
root_spec1 = spack.concretize.concretized(Spec("t"))
|
||||
spec1 = root_spec1["y"]
|
||||
assert spec1.satisfies('cflags="-c1 -c2 -d1 -d2 -e1 -e2"')
|
||||
assert spec1.compiler_flags["cflags"] == "-c1 -c2 -e1 -e2 -d1 -d2".split()
|
||||
|
@ -8,6 +8,7 @@
|
||||
|
||||
import pytest
|
||||
|
||||
import spack.concretize
|
||||
import spack.config
|
||||
import spack.package_prefs
|
||||
import spack.repo
|
||||
@ -47,7 +48,7 @@ def configure_permissions():
|
||||
|
||||
|
||||
def concretize(abstract_spec):
|
||||
return Spec(abstract_spec).concretized()
|
||||
return spack.concretize.concretized(Spec(abstract_spec))
|
||||
|
||||
|
||||
def update_packages(pkgname, section, value):
|
||||
@ -112,7 +113,7 @@ def test_preferred_variants_from_wildcard(self):
|
||||
def test_preferred_compilers(self, compiler_str, spec_str):
|
||||
"""Test preferred compilers are applied correctly"""
|
||||
update_packages("all", "compiler", [compiler_str])
|
||||
spec = spack.spec.Spec(spec_str).concretized()
|
||||
spec = spack.concretize.concretized(spack.spec.Spec(spec_str))
|
||||
assert spec.compiler == CompilerSpec(compiler_str)
|
||||
|
||||
def test_preferred_target(self, mutable_mock_repo):
|
||||
@ -214,15 +215,13 @@ def test_config_set_pkg_property_new(self, mock_repo_path):
|
||||
|
||||
def test_preferred(self):
|
||||
""" "Test packages with some version marked as preferred=True"""
|
||||
spec = Spec("python")
|
||||
spec.concretize()
|
||||
spec = spack.concretize.concretized(Spec("python"))
|
||||
assert spec.version == Version("2.7.11")
|
||||
|
||||
# now add packages.yaml with versions other than preferred
|
||||
# ensure that once config is in place, non-preferred version is used
|
||||
update_packages("python", "version", ["3.5.0"])
|
||||
spec = Spec("python")
|
||||
spec.concretize()
|
||||
spec = spack.concretize.concretized(Spec("python"))
|
||||
assert spec.version == Version("3.5.0")
|
||||
|
||||
def test_preferred_undefined_raises(self):
|
||||
@ -230,7 +229,7 @@ def test_preferred_undefined_raises(self):
|
||||
update_packages("python", "version", ["3.5.0.1"])
|
||||
spec = Spec("python")
|
||||
with pytest.raises(ConfigError):
|
||||
spec.concretize()
|
||||
spack.concretize.concretized(spec)
|
||||
|
||||
def test_preferred_truncated(self):
|
||||
"""Versions without "=" are treated as version ranges: if there is
|
||||
@ -238,35 +237,29 @@ def test_preferred_truncated(self):
|
||||
(don't define a new version).
|
||||
"""
|
||||
update_packages("python", "version", ["3.5"])
|
||||
spec = Spec("python")
|
||||
spec.concretize()
|
||||
spec = spack.concretize.concretized(Spec("python"))
|
||||
assert spec.satisfies("@3.5.1")
|
||||
|
||||
def test_develop(self):
|
||||
"""Test concretization with develop-like versions"""
|
||||
spec = Spec("develop-test")
|
||||
spec.concretize()
|
||||
spec = spack.concretize.concretized(Spec("develop-test"))
|
||||
assert spec.version == Version("0.2.15")
|
||||
spec = Spec("develop-test2")
|
||||
spec.concretize()
|
||||
spec = spack.concretize.concretized(Spec("develop-test2"))
|
||||
assert spec.version == Version("0.2.15")
|
||||
|
||||
# now add packages.yaml with develop-like versions
|
||||
# ensure that once config is in place, develop-like version is used
|
||||
update_packages("develop-test", "version", ["develop"])
|
||||
spec = Spec("develop-test")
|
||||
spec.concretize()
|
||||
spec = spack.concretize.concretized(Spec("develop-test"))
|
||||
assert spec.version == Version("develop")
|
||||
|
||||
update_packages("develop-test2", "version", ["0.2.15.develop"])
|
||||
spec = Spec("develop-test2")
|
||||
spec.concretize()
|
||||
spec = spack.concretize.concretized(Spec("develop-test2"))
|
||||
assert spec.version == Version("0.2.15.develop")
|
||||
|
||||
def test_external_mpi(self):
|
||||
# make sure this doesn't give us an external first.
|
||||
spec = Spec("mpi")
|
||||
spec.concretize()
|
||||
spec = spack.concretize.concretized(Spec("mpi"))
|
||||
assert not spec["mpi"].external
|
||||
|
||||
# load config
|
||||
@ -285,8 +278,7 @@ def test_external_mpi(self):
|
||||
spack.config.set("packages", conf, scope="concretize")
|
||||
|
||||
# ensure that once config is in place, external is used
|
||||
spec = Spec("mpi")
|
||||
spec.concretize()
|
||||
spec = spack.concretize.concretized(Spec("mpi"))
|
||||
assert spec["mpich"].external_path == os.path.sep + os.path.join("dummy", "path")
|
||||
|
||||
def test_external_module(self, monkeypatch):
|
||||
@ -301,8 +293,7 @@ def mock_module(cmd, module):
|
||||
|
||||
monkeypatch.setattr(spack.util.module_cmd, "module", mock_module)
|
||||
|
||||
spec = Spec("mpi")
|
||||
spec.concretize()
|
||||
spec = spack.concretize.concretized(Spec("mpi"))
|
||||
assert not spec["mpi"].external
|
||||
|
||||
# load config
|
||||
@ -321,8 +312,7 @@ def mock_module(cmd, module):
|
||||
spack.config.set("packages", conf, scope="concretize")
|
||||
|
||||
# ensure that once config is in place, external is used
|
||||
spec = Spec("mpi")
|
||||
spec.concretize()
|
||||
spec = spack.concretize.concretized(Spec("mpi"))
|
||||
assert spec["mpich"].external_path == os.path.sep + os.path.join("dummy", "path")
|
||||
|
||||
def test_buildable_false(self):
|
||||
@ -468,7 +458,7 @@ def test_variant_not_flipped_to_pull_externals(self):
|
||||
"""Test that a package doesn't prefer pulling in an
|
||||
external to using the default value of a variant.
|
||||
"""
|
||||
s = Spec("vdefault-or-external-root").concretized()
|
||||
s = spack.concretize.concretized(Spec("vdefault-or-external-root"))
|
||||
|
||||
assert "~external" in s["vdefault-or-external"]
|
||||
assert "externaltool" not in s
|
||||
@ -480,7 +470,7 @@ def test_dependencies_cant_make_version_parent_score_better(self):
|
||||
that makes the overall version score even or better and maybe
|
||||
has a better score in some lower priority criteria.
|
||||
"""
|
||||
s = Spec("version-test-root").concretized()
|
||||
s = spack.concretize.concretized(Spec("version-test-root"))
|
||||
|
||||
assert s.satisfies("^version-test-pkg@2.4.6")
|
||||
assert "version-test-dependency-preferred" not in s
|
||||
@ -498,13 +488,13 @@ def test_multivalued_variants_are_lower_priority_than_providers(self):
|
||||
with spack.config.override(
|
||||
"packages:all", {"providers": {"somevirtual": ["some-virtual-preferred"]}}
|
||||
):
|
||||
s = Spec("somevirtual").concretized()
|
||||
s = spack.concretize.concretized(Spec("somevirtual"))
|
||||
assert s.name == "some-virtual-preferred"
|
||||
|
||||
@pytest.mark.regression("26721,19736")
|
||||
def test_sticky_variant_accounts_for_packages_yaml(self):
|
||||
with spack.config.override("packages:sticky-variant", {"variants": "+allow-gcc"}):
|
||||
s = Spec("sticky-variant %gcc").concretized()
|
||||
s = spack.concretize.concretized(Spec("sticky-variant %gcc"))
|
||||
assert s.satisfies("%gcc") and s.satisfies("+allow-gcc")
|
||||
|
||||
@pytest.mark.regression("41134")
|
||||
@ -513,5 +503,5 @@ def test_default_preference_variant_different_type_does_not_error(self):
|
||||
packages.yaml doesn't fail with an error.
|
||||
"""
|
||||
with spack.config.override("packages:all", {"variants": "+foo"}):
|
||||
s = Spec("pkg-a").concretized()
|
||||
s = spack.concretize.concretized(Spec("pkg-a"))
|
||||
assert s.satisfies("foo=bar")
|
||||
|
@ -7,6 +7,7 @@
|
||||
|
||||
import pytest
|
||||
|
||||
import spack.concretize
|
||||
import spack.config
|
||||
import spack.error
|
||||
import spack.package_base
|
||||
@ -43,7 +44,7 @@ def test_one_package_multiple_reqs(concretize_scope, test_repo):
|
||||
- "~shared"
|
||||
"""
|
||||
update_packages_config(conf_str)
|
||||
y_spec = Spec("y").concretized()
|
||||
y_spec = spack.concretize.concretized(Spec("y"))
|
||||
assert y_spec.satisfies("@2.4~shared")
|
||||
|
||||
|
||||
@ -58,7 +59,7 @@ def test_requirement_isnt_optional(concretize_scope, test_repo):
|
||||
"""
|
||||
update_packages_config(conf_str)
|
||||
with pytest.raises(UnsatisfiableSpecError):
|
||||
Spec("x@1.1").concretize()
|
||||
spack.concretize.concretized(Spec("x@1.1"))
|
||||
|
||||
|
||||
def test_require_undefined_version(concretize_scope, test_repo):
|
||||
@ -75,7 +76,7 @@ def test_require_undefined_version(concretize_scope, test_repo):
|
||||
"""
|
||||
update_packages_config(conf_str)
|
||||
with pytest.raises(spack.error.ConfigError):
|
||||
Spec("x").concretize()
|
||||
spack.concretize.concretized(Spec("x"))
|
||||
|
||||
|
||||
def test_require_truncated(concretize_scope, test_repo):
|
||||
@ -90,7 +91,7 @@ def test_require_truncated(concretize_scope, test_repo):
|
||||
require: "@1"
|
||||
"""
|
||||
update_packages_config(conf_str)
|
||||
xspec = Spec("x").concretized()
|
||||
xspec = spack.concretize.concretized(Spec("x"))
|
||||
assert xspec.satisfies("@1.1")
|
||||
|
||||
|
||||
@ -160,7 +161,7 @@ def test_requirement_adds_new_version(
|
||||
)
|
||||
update_packages_config(conf_str)
|
||||
|
||||
s1 = Spec("v").concretized()
|
||||
s1 = spack.concretize.concretized(Spec("v"))
|
||||
assert s1.satisfies("@2.2")
|
||||
# Make sure the git commit info is retained
|
||||
assert isinstance(s1.version, spack.version.GitVersion)
|
||||
@ -181,7 +182,7 @@ def test_requirement_adds_version_satisfies(
|
||||
)
|
||||
|
||||
# Sanity check: early version of T does not include U
|
||||
s0 = Spec("t@2.0").concretized()
|
||||
s0 = spack.concretize.concretized(Spec("t@2.0"))
|
||||
assert not ("u" in s0)
|
||||
|
||||
conf_str = """\
|
||||
@ -193,7 +194,7 @@ def test_requirement_adds_version_satisfies(
|
||||
)
|
||||
update_packages_config(conf_str)
|
||||
|
||||
s1 = Spec("t").concretized()
|
||||
s1 = spack.concretize.concretized(Spec("t"))
|
||||
assert "u" in s1
|
||||
assert s1.satisfies("@2.2")
|
||||
|
||||
@ -219,7 +220,7 @@ def test_requirement_adds_git_hash_version(
|
||||
"""
|
||||
update_packages_config(conf_str)
|
||||
|
||||
s1 = Spec("v").concretized()
|
||||
s1 = spack.concretize.concretized(Spec("v"))
|
||||
assert isinstance(s1.version, spack.version.GitVersion)
|
||||
assert s1.satisfies(f"v@{a_commit_hash}")
|
||||
|
||||
@ -240,8 +241,8 @@ def test_requirement_adds_multiple_new_versions(
|
||||
"""
|
||||
update_packages_config(conf_str)
|
||||
|
||||
assert Spec("v").concretized().satisfies(f"@{commits[0]}=2.2")
|
||||
assert Spec("v@2.3").concretized().satisfies(f"v@{commits[1]}=2.3")
|
||||
assert spack.concretize.concretized(Spec("v")).satisfies(f"@{commits[0]}=2.2")
|
||||
assert spack.concretize.concretized(Spec("v@2.3")).satisfies(f"v@{commits[1]}=2.3")
|
||||
|
||||
|
||||
# TODO: this belongs in the concretize_preferences test module but uses
|
||||
@ -264,11 +265,11 @@ def test_preference_adds_new_version(
|
||||
"""
|
||||
update_packages_config(conf_str)
|
||||
|
||||
assert Spec("v").concretized().satisfies(f"@{commits[0]}=2.2")
|
||||
assert Spec("v@2.3").concretized().satisfies(f"@{commits[1]}=2.3")
|
||||
assert spack.concretize.concretized(Spec("v")).satisfies(f"@{commits[0]}=2.2")
|
||||
assert spack.concretize.concretized(Spec("v@2.3")).satisfies(f"@{commits[1]}=2.3")
|
||||
|
||||
# When installing by hash, a lookup is triggered, so it's not mapped to =2.3.
|
||||
s3 = Spec(f"v@{commits[1]}").concretized()
|
||||
s3 = spack.concretize.concretized(Spec(f"v@{commits[1]}"))
|
||||
assert s3.satisfies(f"v@{commits[1]}")
|
||||
assert not s3.satisfies("@2.3")
|
||||
|
||||
@ -288,7 +289,7 @@ def test_external_adds_new_version_that_is_preferred(concretize_scope, test_repo
|
||||
"""
|
||||
update_packages_config(conf_str)
|
||||
|
||||
spec = Spec("x").concretized()
|
||||
spec = spack.concretize.concretized(Spec("x"))
|
||||
assert spec["y"].satisfies("@2.7")
|
||||
assert spack.version.Version("2.7") not in spec["y"].package.versions
|
||||
|
||||
@ -297,7 +298,7 @@ def test_requirement_is_successfully_applied(concretize_scope, test_repo):
|
||||
"""If a simple requirement can be satisfied, make sure the
|
||||
concretization succeeds and the requirement spec is applied.
|
||||
"""
|
||||
s1 = Spec("x").concretized()
|
||||
s1 = spack.concretize.concretized(Spec("x"))
|
||||
# Without any requirements/preferences, the later version is preferred
|
||||
assert s1.satisfies("@1.1")
|
||||
|
||||
@ -307,7 +308,7 @@ def test_requirement_is_successfully_applied(concretize_scope, test_repo):
|
||||
require: "@1.0"
|
||||
"""
|
||||
update_packages_config(conf_str)
|
||||
s2 = Spec("x").concretized()
|
||||
s2 = spack.concretize.concretized(Spec("x"))
|
||||
# The requirement forces choosing the eariler version
|
||||
assert s2.satisfies("@1.0")
|
||||
|
||||
@ -324,7 +325,7 @@ def test_multiple_packages_requirements_are_respected(concretize_scope, test_rep
|
||||
require: "@2.4"
|
||||
"""
|
||||
update_packages_config(conf_str)
|
||||
spec = Spec("x").concretized()
|
||||
spec = spack.concretize.concretized(Spec("x"))
|
||||
assert spec["x"].satisfies("@1.0")
|
||||
assert spec["y"].satisfies("@2.4")
|
||||
|
||||
@ -340,7 +341,7 @@ def test_oneof(concretize_scope, test_repo):
|
||||
- one_of: ["@2.4", "~shared"]
|
||||
"""
|
||||
update_packages_config(conf_str)
|
||||
spec = Spec("x").concretized()
|
||||
spec = spack.concretize.concretized(Spec("x"))
|
||||
# The concretizer only has to satisfy one of @2.4/~shared, and @2.4
|
||||
# comes first so it is prioritized
|
||||
assert spec["y"].satisfies("@2.4+shared")
|
||||
@ -359,10 +360,10 @@ def test_one_package_multiple_oneof_groups(concretize_scope, test_repo):
|
||||
"""
|
||||
update_packages_config(conf_str)
|
||||
|
||||
s1 = Spec("y@2.5").concretized()
|
||||
s1 = spack.concretize.concretized(Spec("y@2.5"))
|
||||
assert s1.satisfies("%clang~shared")
|
||||
|
||||
s2 = Spec("y@2.4").concretized()
|
||||
s2 = spack.concretize.concretized(Spec("y@2.4"))
|
||||
assert s2.satisfies("%gcc+shared")
|
||||
|
||||
|
||||
@ -378,10 +379,10 @@ def test_require_cflags(concretize_scope, mock_packages):
|
||||
"""
|
||||
update_packages_config(conf_str)
|
||||
|
||||
spec_mpich2 = Spec("mpich2").concretized()
|
||||
spec_mpich2 = spack.concretize.concretized(Spec("mpich2"))
|
||||
assert spec_mpich2.satisfies("cflags=-g")
|
||||
|
||||
spec_mpi = Spec("mpi").concretized()
|
||||
spec_mpi = spack.concretize.concretized(Spec("mpi"))
|
||||
assert spec_mpi.satisfies("mpich cflags=-O1")
|
||||
|
||||
|
||||
@ -404,7 +405,7 @@ def test_requirements_for_package_that_is_not_needed(concretize_scope, test_repo
|
||||
"""
|
||||
update_packages_config(conf_str)
|
||||
|
||||
s1 = Spec("v").concretized()
|
||||
s1 = spack.concretize.concretized(Spec("v"))
|
||||
assert s1.satisfies("@2.1")
|
||||
|
||||
|
||||
@ -421,10 +422,10 @@ def test_oneof_ordering(concretize_scope, test_repo):
|
||||
"""
|
||||
update_packages_config(conf_str)
|
||||
|
||||
s1 = Spec("y").concretized()
|
||||
s1 = spack.concretize.concretized(Spec("y"))
|
||||
assert s1.satisfies("@2.4")
|
||||
|
||||
s2 = Spec("y@2.5").concretized()
|
||||
s2 = spack.concretize.concretized(Spec("y@2.5"))
|
||||
assert s2.satisfies("@2.5")
|
||||
|
||||
|
||||
@ -438,14 +439,14 @@ def test_reuse_oneof(concretize_scope, test_repo, tmp_path, mock_fetch):
|
||||
|
||||
store_dir = tmp_path / "store"
|
||||
with spack.store.use_store(str(store_dir)):
|
||||
s1 = Spec("y@2.5 ~shared").concretized()
|
||||
s1 = spack.concretize.concretized(Spec("y@2.5~shared"))
|
||||
PackageInstaller([s1.package], fake=True, explicit=True).install()
|
||||
|
||||
update_packages_config(conf_str)
|
||||
|
||||
with spack.config.override("concretizer:reuse", True):
|
||||
s2 = Spec("y").concretized()
|
||||
assert not s2.satisfies("@2.5 ~shared")
|
||||
s2 = spack.concretize.concretized(Spec("y"))
|
||||
assert not s2.satisfies("@2.5~shared")
|
||||
|
||||
|
||||
@pytest.mark.parametrize(
|
||||
@ -473,7 +474,7 @@ def test_requirements_and_deprecated_versions(
|
||||
update_packages_config(conf_str)
|
||||
|
||||
with spack.config.override("config:deprecated", allow_deprecated):
|
||||
s1 = Spec("y").concretized()
|
||||
s1 = spack.concretize.concretized(Spec("y"))
|
||||
for constrain in expected:
|
||||
assert s1.satisfies(constrain)
|
||||
|
||||
@ -491,7 +492,7 @@ def test_default_requirements_with_all(spec_str, requirement_str, concretize_sco
|
||||
"""
|
||||
update_packages_config(conf_str)
|
||||
|
||||
spec = Spec(spec_str).concretized()
|
||||
spec = spack.concretize.concretized(Spec(spec_str))
|
||||
for s in spec.traverse():
|
||||
assert s.satisfies(requirement_str)
|
||||
|
||||
@ -500,7 +501,7 @@ def test_default_requirements_with_all(spec_str, requirement_str, concretize_sco
|
||||
"requirements,expectations",
|
||||
[
|
||||
(("%gcc", "%clang"), ("%gcc", "%clang")),
|
||||
(("%gcc ~shared", "@1.0"), ("%gcc ~shared", "@1.0 +shared")),
|
||||
(("%gcc~shared", "@1.0"), ("%gcc~shared", "@1.0+shared")),
|
||||
],
|
||||
)
|
||||
def test_default_and_package_specific_requirements(
|
||||
@ -518,7 +519,7 @@ def test_default_and_package_specific_requirements(
|
||||
"""
|
||||
update_packages_config(conf_str)
|
||||
|
||||
spec = Spec("x").concretized()
|
||||
spec = spack.concretize.concretized(Spec("x"))
|
||||
assert spec.satisfies(specific_exp)
|
||||
for s in spec.traverse(root=False):
|
||||
assert s.satisfies(generic_exp)
|
||||
@ -533,7 +534,7 @@ def test_requirements_on_virtual(mpi_requirement, concretize_scope, mock_package
|
||||
"""
|
||||
update_packages_config(conf_str)
|
||||
|
||||
spec = Spec("callpath").concretized()
|
||||
spec = spack.concretize.concretized(Spec("callpath"))
|
||||
assert "mpi" in spec
|
||||
assert mpi_requirement in spec
|
||||
|
||||
@ -554,7 +555,7 @@ def test_requirements_on_virtual_and_on_package(
|
||||
"""
|
||||
update_packages_config(conf_str)
|
||||
|
||||
spec = Spec("callpath").concretized()
|
||||
spec = spack.concretize.concretized(Spec("callpath"))
|
||||
assert "mpi" in spec
|
||||
assert mpi_requirement in spec
|
||||
assert spec["mpi"].satisfies(specific_requirement)
|
||||
@ -568,10 +569,10 @@ def test_incompatible_virtual_requirements_raise(concretize_scope, mock_packages
|
||||
"""
|
||||
update_packages_config(conf_str)
|
||||
|
||||
spec = Spec("callpath ^zmpi")
|
||||
spec = Spec("callpath^zmpi")
|
||||
# TODO (multiple nodes): recover a better error message later
|
||||
with pytest.raises((UnsatisfiableSpecError, InternalConcretizerError)):
|
||||
spec.concretize()
|
||||
spack.concretize.concretized(spec)
|
||||
|
||||
|
||||
def test_non_existing_variants_under_all(concretize_scope, mock_packages):
|
||||
@ -583,7 +584,7 @@ def test_non_existing_variants_under_all(concretize_scope, mock_packages):
|
||||
"""
|
||||
update_packages_config(conf_str)
|
||||
|
||||
spec = Spec("callpath ^zmpi").concretized()
|
||||
spec = spack.concretize.concretized(Spec("callpath^zmpi"))
|
||||
assert "~foo" not in spec
|
||||
|
||||
|
||||
@ -658,7 +659,7 @@ def test_conditional_requirements_from_packages_yaml(
|
||||
and optional when the condition is not met.
|
||||
"""
|
||||
update_packages_config(packages_yaml)
|
||||
spec = Spec(spec_str).concretized()
|
||||
spec = spack.concretize.concretized(Spec(spec_str))
|
||||
for match_str, expected in expected_satisfies:
|
||||
assert spec.satisfies(match_str) is expected
|
||||
|
||||
@ -734,7 +735,7 @@ def test_requirements_fail_with_custom_message(
|
||||
"""
|
||||
update_packages_config(packages_yaml)
|
||||
with pytest.raises(spack.error.SpackError, match=expected_message):
|
||||
Spec(spec_str).concretized()
|
||||
spack.concretize.concretized(Spec(spec_str))
|
||||
|
||||
|
||||
def test_skip_requirement_when_default_requirement_condition_cannot_be_met(
|
||||
@ -753,9 +754,9 @@ def test_skip_requirement_when_default_requirement_condition_cannot_be_met(
|
||||
when: "+shared"
|
||||
"""
|
||||
update_packages_config(packages_yaml)
|
||||
s = Spec("mpileaks").concretized()
|
||||
s = spack.concretize.concretized(Spec("mpileaks"))
|
||||
|
||||
assert s.satisfies("%clang +shared")
|
||||
assert s.satisfies("%clang+shared")
|
||||
# Sanity checks that 'callpath' doesn't have the shared variant, but that didn't
|
||||
# cause failures during concretization.
|
||||
assert "shared" not in s["callpath"].variants
|
||||
@ -782,12 +783,12 @@ def test_requires_directive(concretize_scope, mock_packages):
|
||||
spack.config.CONFIG.clear_caches()
|
||||
|
||||
# This package requires either clang or gcc
|
||||
s = Spec("requires_clang_or_gcc").concretized()
|
||||
s = spack.concretize.concretized(Spec("requires_clang_or_gcc"))
|
||||
assert s.satisfies("%gcc@12.0.0")
|
||||
|
||||
# This package can only be compiled with clang
|
||||
with pytest.raises(spack.error.SpackError, match="can only be compiled with Clang"):
|
||||
Spec("requires_clang").concretized()
|
||||
spack.concretize.concretized(Spec("requires_clang"))
|
||||
|
||||
|
||||
@pytest.mark.parametrize(
|
||||
@ -840,20 +841,20 @@ def test_default_requirements_semantic(packages_yaml, concretize_scope, mock_pac
|
||||
"""
|
||||
update_packages_config(packages_yaml)
|
||||
|
||||
# Regular zlib concretize to +shared
|
||||
s = Spec("zlib").concretized()
|
||||
# Regular zlib concretize to+shared
|
||||
s = spack.concretize.concretized(Spec("zlib"))
|
||||
assert s.satisfies("+shared")
|
||||
|
||||
# If we specify the variant we can concretize only the one matching the constraint
|
||||
s = Spec("zlib +shared").concretized()
|
||||
s = spack.concretize.concretized(Spec("zlib+shared"))
|
||||
assert s.satisfies("+shared")
|
||||
with pytest.raises(UnsatisfiableSpecError):
|
||||
Spec("zlib ~shared").concretized()
|
||||
spack.concretize.concretized(Spec("zlib~shared"))
|
||||
|
||||
# A spec without the shared variant still concretize
|
||||
s = Spec("pkg-a").concretized()
|
||||
assert not s.satisfies("pkg-a +shared")
|
||||
assert not s.satisfies("pkg-a ~shared")
|
||||
s = spack.concretize.concretized(Spec("pkg-a"))
|
||||
assert not s.satisfies("pkg-a+shared")
|
||||
assert not s.satisfies("pkg-a~shared")
|
||||
|
||||
|
||||
@pytest.mark.parametrize(
|
||||
@ -897,7 +898,7 @@ def test_default_requirements_semantic(packages_yaml, concretize_scope, mock_pac
|
||||
"""
|
||||
packages:
|
||||
all:
|
||||
require: "libs=static +feefoo"
|
||||
require: "libs=static+feefoo"
|
||||
""",
|
||||
"multivalue-variant",
|
||||
["libs=shared"],
|
||||
@ -912,7 +913,7 @@ def test_default_requirements_semantic_with_mv_variants(
|
||||
from MV variants.
|
||||
"""
|
||||
update_packages_config(packages_yaml)
|
||||
s = Spec(spec_str).concretized()
|
||||
s = spack.concretize.concretized(Spec(spec_str))
|
||||
|
||||
for constraint in expected:
|
||||
assert s.satisfies(constraint), constraint
|
||||
@ -937,7 +938,7 @@ def test_requiring_package_on_multiple_virtuals(concretize_scope, mock_packages)
|
||||
require: intel-parallel-studio
|
||||
"""
|
||||
)
|
||||
s = Spec("dla-future").concretized()
|
||||
s = spack.concretize.concretized(Spec("dla-future"))
|
||||
|
||||
assert s["blas"].name == "intel-parallel-studio"
|
||||
assert s["lapack"].name == "intel-parallel-studio"
|
||||
@ -990,7 +991,7 @@ def test_strong_preferences_packages_yaml(
|
||||
):
|
||||
"""Tests that "preferred" specs are stronger than usual preferences, but can be overridden."""
|
||||
update_packages_config(packages_yaml)
|
||||
s = Spec(spec_str).concretized()
|
||||
s = spack.concretize.concretized(Spec(spec_str))
|
||||
|
||||
for constraint in expected:
|
||||
assert s.satisfies(constraint), constraint
|
||||
@ -1039,29 +1040,29 @@ def test_conflict_packages_yaml(packages_yaml, spec_str, concretize_scope, mock_
|
||||
"""Tests conflicts that are specified from configuration files."""
|
||||
update_packages_config(packages_yaml)
|
||||
with pytest.raises(UnsatisfiableSpecError):
|
||||
Spec(spec_str).concretized()
|
||||
spack.concretize.concretized(Spec(spec_str))
|
||||
|
||||
|
||||
@pytest.mark.parametrize(
|
||||
"spec_str,expected,not_expected",
|
||||
[
|
||||
(
|
||||
"forward-multi-value +cuda cuda_arch=10 ^dependency-mv~cuda",
|
||||
"forward-multi-value+cuda cuda_arch=10^dependency-mv~cuda",
|
||||
["cuda_arch=10", "^dependency-mv~cuda"],
|
||||
["cuda_arch=11", "^dependency-mv cuda_arch=10", "^dependency-mv cuda_arch=11"],
|
||||
),
|
||||
(
|
||||
"forward-multi-value +cuda cuda_arch=10 ^dependency-mv+cuda",
|
||||
"forward-multi-value+cuda cuda_arch=10^dependency-mv+cuda",
|
||||
["cuda_arch=10", "^dependency-mv cuda_arch=10"],
|
||||
["cuda_arch=11", "^dependency-mv cuda_arch=11"],
|
||||
),
|
||||
(
|
||||
"forward-multi-value +cuda cuda_arch=11 ^dependency-mv+cuda",
|
||||
"forward-multi-value+cuda cuda_arch=11^dependency-mv+cuda",
|
||||
["cuda_arch=11", "^dependency-mv cuda_arch=11"],
|
||||
["cuda_arch=10", "^dependency-mv cuda_arch=10"],
|
||||
),
|
||||
(
|
||||
"forward-multi-value +cuda cuda_arch=10,11 ^dependency-mv+cuda",
|
||||
"forward-multi-value+cuda cuda_arch=10,11^dependency-mv+cuda",
|
||||
["cuda_arch=10,11", "^dependency-mv cuda_arch=10,11"],
|
||||
[],
|
||||
),
|
||||
@ -1074,9 +1075,9 @@ def test_forward_multi_valued_variant_using_requires(
|
||||
`requires` directives of the form:
|
||||
|
||||
for _val in ("shared", "static"):
|
||||
requires(f"^some-virtual-mv libs={_val}", when=f"libs={_val} ^some-virtual-mv")
|
||||
requires(f"^some-virtual-mv libs={_val}", when=f"libs={_val}^some-virtual-mv")
|
||||
"""
|
||||
s = Spec(spec_str).concretized()
|
||||
s = spack.concretize.concretized(Spec(spec_str))
|
||||
|
||||
for constraint in expected:
|
||||
assert s.satisfies(constraint)
|
||||
@ -1087,7 +1088,7 @@ def test_forward_multi_valued_variant_using_requires(
|
||||
|
||||
def test_strong_preferences_higher_priority_than_reuse(concretize_scope, mock_packages):
|
||||
"""Tests that strong preferences have a higher priority than reusing specs."""
|
||||
reused_spec = Spec("adios2~bzip2").concretized()
|
||||
reused_spec = spack.concretize.concretized(Spec("adios2~bzip2"))
|
||||
reuse_nodes = list(reused_spec.traverse())
|
||||
root_specs = [Spec("ascent+adios2")]
|
||||
|
||||
@ -1122,7 +1123,7 @@ def test_strong_preferences_higher_priority_than_reuse(concretize_scope, mock_pa
|
||||
solver = spack.solver.asp.Solver()
|
||||
setup = spack.solver.asp.SpackSolverSetup()
|
||||
result, _, _ = solver.driver.solve(
|
||||
setup, [Spec("ascent+adios2 ^adios2~bzip2")], reuse=reuse_nodes
|
||||
setup, [Spec("ascent+adios2^adios2~bzip2")], reuse=reuse_nodes
|
||||
)
|
||||
ascent = result.specs[0]
|
||||
assert ascent["adios2"].dag_hash() == reused_spec.dag_hash(), ascent
|
||||
|
@ -5,6 +5,7 @@
|
||||
|
||||
import pytest
|
||||
|
||||
import spack.concretize
|
||||
import spack.spec
|
||||
import spack.store
|
||||
|
||||
@ -14,7 +15,7 @@
|
||||
def test_set_install_hash_length(hash_length, mutable_config, tmpdir):
|
||||
mutable_config.set("config:install_hash_length", hash_length)
|
||||
with spack.store.use_store(str(tmpdir)):
|
||||
spec = spack.spec.Spec("libelf").concretized()
|
||||
spec = spack.concretize.concretized(spack.spec.Spec("libelf"))
|
||||
prefix = spec.prefix
|
||||
hash_str = prefix.rsplit("-")[-1]
|
||||
assert len(hash_str) == hash_length
|
||||
@ -24,7 +25,7 @@ def test_set_install_hash_length(hash_length, mutable_config, tmpdir):
|
||||
def test_set_install_hash_length_upper_case(mutable_config, tmpdir):
|
||||
mutable_config.set("config:install_hash_length", 5)
|
||||
with spack.store.use_store(str(tmpdir), extra_data={"projections": {"all": "{name}-{HASH}"}}):
|
||||
spec = spack.spec.Spec("libelf").concretized()
|
||||
spec = spack.concretize.concretized(spack.spec.Spec("libelf"))
|
||||
prefix = spec.prefix
|
||||
hash_str = prefix.rsplit("-")[-1]
|
||||
assert len(hash_str) == 5
|
||||
|
@ -37,6 +37,7 @@
|
||||
import spack.caches
|
||||
import spack.compiler
|
||||
import spack.compilers
|
||||
import spack.concretize
|
||||
import spack.config
|
||||
import spack.directives_meta
|
||||
import spack.environment as ev
|
||||
@ -855,7 +856,7 @@ def _populate(mock_db):
|
||||
"""
|
||||
|
||||
def _install(spec):
|
||||
s = spack.spec.Spec(spec).concretized()
|
||||
s = spack.concretize.concretized(spack.spec.Spec(spec))
|
||||
PackageInstaller([s.package], fake=True, explicit=True).install()
|
||||
|
||||
_install("mpileaks ^mpich")
|
||||
@ -1989,7 +1990,9 @@ def default_mock_concretization(config, mock_packages, concretized_specs_cache):
|
||||
def _func(spec_str, tests=False):
|
||||
key = spec_str, tests
|
||||
if key not in concretized_specs_cache:
|
||||
concretized_specs_cache[key] = spack.spec.Spec(spec_str).concretized(tests=tests)
|
||||
concretized_specs_cache[key] = spack.concretize.concretized(
|
||||
spack.spec.Spec(spec_str), tests=tests
|
||||
)
|
||||
return concretized_specs_cache[key].copy()
|
||||
|
||||
return _func
|
||||
|
@ -9,6 +9,7 @@
|
||||
|
||||
from llnl.util.filesystem import mkdirp, touch, working_dir
|
||||
|
||||
import spack.concretize
|
||||
from spack.fetch_strategy import CvsFetchStrategy
|
||||
from spack.spec import Spec
|
||||
from spack.stage import Stage
|
||||
@ -38,7 +39,7 @@ def test_fetch(type_of_test, mock_cvs_repository, config, mutable_mock_repo):
|
||||
get_date = mock_cvs_repository.get_date
|
||||
|
||||
# Construct the package under test
|
||||
spec = Spec("cvs-test").concretized()
|
||||
spec = spack.concretize.concretized(Spec("cvs-test"))
|
||||
spec.package.versions[Version("cvs")] = test.args
|
||||
|
||||
# Enter the stage directory and check some properties
|
||||
|
@ -27,6 +27,7 @@
|
||||
import llnl.util.lock as lk
|
||||
from llnl.util.tty.colify import colify
|
||||
|
||||
import spack.concretize
|
||||
import spack.database
|
||||
import spack.deptypes as dt
|
||||
import spack.package_base
|
||||
@ -78,8 +79,8 @@ def test_query_by_install_tree(
|
||||
up_write_db, up_db, down_db = upstream_and_downstream_db
|
||||
|
||||
# Set the upstream DB to contain "pkg-c" and downstream to contain "pkg-b")
|
||||
b = spack.spec.Spec("pkg-b").concretized()
|
||||
c = spack.spec.Spec("pkg-c").concretized()
|
||||
b = spack.concretize.concretized(spack.spec.Spec("pkg-b"))
|
||||
c = spack.concretize.concretized(spack.spec.Spec("pkg-c"))
|
||||
up_write_db.add(c)
|
||||
up_db._read()
|
||||
down_db.add(b)
|
||||
@ -96,7 +97,7 @@ def test_spec_installed_upstream(
|
||||
|
||||
# a known installed spec should say that it's installed
|
||||
with spack.repo.use_repositories(mock_custom_repository):
|
||||
spec = spack.spec.Spec("pkg-c").concretized()
|
||||
spec = spack.concretize.concretized(spack.spec.Spec("pkg-c"))
|
||||
assert not spec.installed
|
||||
assert not spec.installed_upstream
|
||||
|
||||
@ -125,7 +126,7 @@ def test_installed_upstream(upstream_and_downstream_db, tmpdir):
|
||||
builder.add_package("w", dependencies=[("x", None, None), ("y", None, None)])
|
||||
|
||||
with spack.repo.use_repositories(builder.root):
|
||||
spec = spack.spec.Spec("w").concretized()
|
||||
spec = spack.concretize.concretized(spack.spec.Spec("w"))
|
||||
for dep in spec.traverse(root=False):
|
||||
upstream_write_db.add(dep)
|
||||
upstream_db._read()
|
||||
@ -136,7 +137,7 @@ def test_installed_upstream(upstream_and_downstream_db, tmpdir):
|
||||
with pytest.raises(spack.database.ForbiddenLockError):
|
||||
upstream_db.get_by_hash(dep.dag_hash())
|
||||
|
||||
new_spec = spack.spec.Spec("w").concretized()
|
||||
new_spec = spack.concretize.concretized(spack.spec.Spec("w"))
|
||||
downstream_db.add(new_spec)
|
||||
for dep in new_spec.traverse(root=False):
|
||||
upstream, record = downstream_db.query_by_spec_hash(dep.dag_hash())
|
||||
@ -158,7 +159,7 @@ def test_removed_upstream_dep(upstream_and_downstream_db, tmpdir, capsys, config
|
||||
builder.add_package("y", dependencies=[("z", None, None)])
|
||||
|
||||
with spack.repo.use_repositories(builder):
|
||||
y = spack.spec.Spec("y").concretized()
|
||||
y = spack.concretize.concretized(spack.spec.Spec("y"))
|
||||
z = y["z"]
|
||||
|
||||
# add dependency to upstream, dependents to downstream
|
||||
@ -190,7 +191,7 @@ def test_add_to_upstream_after_downstream(upstream_and_downstream_db, tmpdir):
|
||||
builder.add_package("x")
|
||||
|
||||
with spack.repo.use_repositories(builder.root):
|
||||
spec = spack.spec.Spec("x").concretized()
|
||||
spec = spack.concretize.concretized(spack.spec.Spec("x"))
|
||||
|
||||
downstream_db.add(spec)
|
||||
upstream_write_db.add(spec)
|
||||
@ -222,7 +223,7 @@ def test_cannot_write_upstream(tmp_path, mock_packages, config):
|
||||
db = spack.database.Database(str(tmp_path), is_upstream=True)
|
||||
|
||||
with pytest.raises(spack.database.ForbiddenLockError):
|
||||
db.add(spack.spec.Spec("pkg-a").concretized())
|
||||
db.add(spack.concretize.concretized(spack.spec.Spec("pkg-a")))
|
||||
|
||||
|
||||
@pytest.mark.usefixtures("config", "temporary_store")
|
||||
@ -236,7 +237,7 @@ def test_recursive_upstream_dbs(tmpdir, gen_mock_layout):
|
||||
builder.add_package("x", dependencies=[("y", None, None)])
|
||||
|
||||
with spack.repo.use_repositories(builder.root):
|
||||
spec = spack.spec.Spec("x").concretized()
|
||||
spec = spack.concretize.concretized(spack.spec.Spec("x"))
|
||||
db_c = spack.database.Database(roots[2], layout=layouts[2])
|
||||
db_c.add(spec["z"])
|
||||
|
||||
@ -386,7 +387,7 @@ def _check_remove_and_add_package(database: spack.database.Database, spec):
|
||||
|
||||
|
||||
def _mock_install(spec: str):
|
||||
s = spack.spec.Spec(spec).concretized()
|
||||
s = spack.concretize.concretized(spack.spec.Spec(spec))
|
||||
PackageInstaller([s.package], fake=True, explicit=True).install()
|
||||
|
||||
|
||||
@ -731,8 +732,7 @@ def test_regression_issue_8036(mutable_database, usr_folder_exists):
|
||||
# existing. Even when the package prefix exists, the package should
|
||||
# not be considered installed until it is added to the database by
|
||||
# the installer with install().
|
||||
s = spack.spec.Spec("externaltool@0.9")
|
||||
s.concretize()
|
||||
s = spack.concretize.concretized(spack.spec.Spec("externaltool@0.9"))
|
||||
assert not s.installed
|
||||
|
||||
# Now install the external package and check again the `installed` property
|
||||
@ -747,8 +747,7 @@ def test_old_external_entries_prefix(mutable_database):
|
||||
|
||||
jsonschema.validate(db_obj, schema)
|
||||
|
||||
s = spack.spec.Spec("externaltool")
|
||||
s.concretize()
|
||||
s = spack.concretize.concretized(spack.spec.Spec("externaltool"))
|
||||
|
||||
db_obj["database"]["installs"][s.dag_hash()]["path"] = "None"
|
||||
|
||||
@ -777,8 +776,7 @@ def test_uninstall_by_spec(mutable_database):
|
||||
|
||||
def test_query_unused_specs(mutable_database):
|
||||
# This spec installs a fake cmake as a build only dependency
|
||||
s = spack.spec.Spec("simple-inheritance")
|
||||
s.concretize()
|
||||
s = spack.concretize.concretized(spack.spec.Spec("simple-inheritance"))
|
||||
PackageInstaller([s.package], fake=True, explicit=True).install()
|
||||
|
||||
si = s.dag_hash()
|
||||
@ -820,8 +818,7 @@ def check_unused(roots, deptype, expected):
|
||||
def test_query_spec_with_conditional_dependency(mutable_database):
|
||||
# The issue is triggered by having dependencies that are
|
||||
# conditional on a Boolean variant
|
||||
s = spack.spec.Spec("hdf5~mpi")
|
||||
s.concretize()
|
||||
s = spack.concretize.concretized(spack.spec.Spec("hdf5~mpi"))
|
||||
PackageInstaller([s.package], fake=True, explicit=True).install()
|
||||
|
||||
results = spack.store.STORE.db.query_local("hdf5 ^mpich")
|
||||
@ -861,7 +858,7 @@ def _is(self, spec):
|
||||
# Pretend the spec has been failure locked
|
||||
monkeypatch.setattr(spack.database.FailureTracker, "lock_taken", _is)
|
||||
|
||||
s = spack.spec.Spec("pkg-a").concretized()
|
||||
s = spack.concretize.concretized(spack.spec.Spec("pkg-a"))
|
||||
spack.store.STORE.failure_tracker.clear(s)
|
||||
out = capfd.readouterr()[0]
|
||||
assert "Retaining failure marking" in out
|
||||
@ -879,7 +876,7 @@ def _is(self, spec):
|
||||
# Ensure raise OSError when try to remove the non-existent marking
|
||||
monkeypatch.setattr(spack.database.FailureTracker, "persistent_mark", _is)
|
||||
|
||||
s = spack.spec.Spec("pkg-a").concretized()
|
||||
s = spack.concretize.concretized(spack.spec.Spec("pkg-a"))
|
||||
spack.store.STORE.failure_tracker.clear(s, force=True)
|
||||
out = capfd.readouterr()[1]
|
||||
assert "Removing failure marking despite lock" in out
|
||||
@ -894,7 +891,7 @@ def _raise_exc(lock):
|
||||
raise lk.LockTimeoutError("write", "/mock-lock", 1.234, 10)
|
||||
|
||||
with tmpdir.as_cwd():
|
||||
s = spack.spec.Spec("pkg-a").concretized()
|
||||
s = spack.concretize.concretized(spack.spec.Spec("pkg-a"))
|
||||
|
||||
# Ensure attempt to acquire write lock on the mark raises the exception
|
||||
monkeypatch.setattr(lk.Lock, "acquire_write", _raise_exc)
|
||||
@ -910,7 +907,7 @@ def _raise_exc(lock):
|
||||
def test_prefix_failed(mutable_database, monkeypatch):
|
||||
"""Add coverage to failed operation."""
|
||||
|
||||
s = spack.spec.Spec("pkg-a").concretized()
|
||||
s = spack.concretize.concretized(spack.spec.Spec("pkg-a"))
|
||||
|
||||
# Confirm the spec is not already marked as failed
|
||||
assert not spack.store.STORE.failure_tracker.has_failed(s)
|
||||
@ -934,7 +931,7 @@ def test_prefix_write_lock_error(mutable_database, monkeypatch):
|
||||
def _raise(db, spec):
|
||||
raise lk.LockError("Mock lock error")
|
||||
|
||||
s = spack.spec.Spec("pkg-a").concretized()
|
||||
s = spack.concretize.concretized(spack.spec.Spec("pkg-a"))
|
||||
|
||||
# Ensure subsequent lock operations fail
|
||||
monkeypatch.setattr(lk.Lock, "acquire_write", _raise)
|
||||
@ -1142,7 +1139,7 @@ def test_reindex_with_upstreams(tmp_path, monkeypatch, mock_packages, config):
|
||||
# we install `mpileaks` locally with dependencies in the upstream. And we even install
|
||||
# `mpileaks` with the same hash in the upstream. After reindexing, `mpileaks` should still be
|
||||
# in the local db, and `callpath` should not.
|
||||
mpileaks = spack.spec.Spec("mpileaks").concretized()
|
||||
mpileaks = spack.concretize.concretized(spack.spec.Spec("mpileaks"))
|
||||
callpath = mpileaks.dependencies("callpath")[0]
|
||||
|
||||
upstream_store = spack.store.create(
|
||||
|
@ -6,6 +6,7 @@
|
||||
|
||||
import pytest
|
||||
|
||||
import spack.concretize
|
||||
import spack.directives
|
||||
import spack.repo
|
||||
import spack.spec
|
||||
@ -60,8 +61,8 @@ def test_constraints_from_context_are_merged(mock_packages):
|
||||
|
||||
@pytest.mark.regression("27754")
|
||||
def test_extends_spec(config, mock_packages):
|
||||
extender = spack.spec.Spec("extends-spec").concretized()
|
||||
extendee = spack.spec.Spec("extendee").concretized()
|
||||
extender = spack.concretize.concretized(spack.spec.Spec("extends-spec"))
|
||||
extendee = spack.concretize.concretized(spack.spec.Spec("extendee"))
|
||||
|
||||
assert extender.dependencies
|
||||
assert extender.package.extends(extendee)
|
||||
@ -207,7 +208,7 @@ def test_repo(_create_test_repo, monkeypatch, mock_stage):
|
||||
def test_redistribute_directive(test_repo, spec_str, distribute_src, distribute_bin):
|
||||
spec = spack.spec.Spec(spec_str)
|
||||
assert spec.package_class.redistribute_source(spec) == distribute_src
|
||||
concretized_spec = spec.concretized()
|
||||
concretized_spec = spack.concretize.concretized(spec)
|
||||
assert concretized_spec.package.redistribute_binary == distribute_bin
|
||||
|
||||
|
||||
|
@ -14,6 +14,7 @@
|
||||
|
||||
from llnl.path import path_to_os_path
|
||||
|
||||
import spack.concretize
|
||||
import spack.hash_types
|
||||
import spack.paths
|
||||
import spack.repo
|
||||
@ -60,7 +61,7 @@ def test_yaml_directory_layout_parameters(tmpdir, default_mock_concretization):
|
||||
assert package7 == path_package7
|
||||
|
||||
# Test separation of architecture or namespace
|
||||
spec2 = Spec("libelf").concretized()
|
||||
spec2 = spack.concretize.concretized(Spec("libelf"))
|
||||
|
||||
arch_scheme = (
|
||||
"{architecture.platform}/{architecture.target}/{architecture.os}/{name}/{version}/{hash:7}"
|
||||
@ -98,7 +99,7 @@ def test_read_and_write_spec(temporary_store, config, mock_packages):
|
||||
# If a spec fails to concretize, just skip it. If it is a
|
||||
# real error, it will be caught by concretization tests.
|
||||
try:
|
||||
spec = spack.spec.Spec(name).concretized()
|
||||
spec = spack.concretize.concretized(spack.spec.Spec(name))
|
||||
except Exception:
|
||||
continue
|
||||
|
||||
@ -137,7 +138,7 @@ def test_read_and_write_spec(temporary_store, config, mock_packages):
|
||||
assert norm.eq_dag(spec_from_file)
|
||||
|
||||
# TODO: revise this when build deps are in dag_hash
|
||||
conc = read_separately.concretized().copy(deps=stored_deptypes)
|
||||
conc = spack.concretize.concretized(read_separately).copy(deps=stored_deptypes)
|
||||
assert conc == spec_from_file
|
||||
assert conc.eq_dag(spec_from_file)
|
||||
|
||||
@ -173,12 +174,10 @@ def test_handle_unknown_package(temporary_store, config, mock_packages, tmp_path
|
||||
# Create all the packages that are not in mock.
|
||||
installed_specs = {}
|
||||
for pkg_name in packages:
|
||||
spec = spack.spec.Spec(pkg_name)
|
||||
|
||||
# If a spec fails to concretize, just skip it. If it is a
|
||||
# real error, it will be caught by concretization tests.
|
||||
try:
|
||||
spec.concretize()
|
||||
spec = spack.concretize.concretized(spack.spec.Spec(pkg_name))
|
||||
except Exception:
|
||||
continue
|
||||
|
||||
@ -210,7 +209,7 @@ def test_find(temporary_store, config, mock_packages):
|
||||
if name.startswith("external"):
|
||||
# External package tests cannot be installed
|
||||
continue
|
||||
spec = spack.spec.Spec(name).concretized()
|
||||
spec = spack.concretize.concretized(spack.spec.Spec(name))
|
||||
installed_specs[spec.name] = spec
|
||||
layout.create_install_directory(spec)
|
||||
|
||||
|
@ -8,6 +8,7 @@
|
||||
import pytest
|
||||
|
||||
import spack.build_environment
|
||||
import spack.concretize
|
||||
import spack.spec
|
||||
from spack.package import build_system_flags, env_flags, inject_flags
|
||||
|
||||
@ -31,10 +32,10 @@ def add_o3_to_build_system_cflags(pkg, name, flags):
|
||||
class TestFlagHandlers:
|
||||
def test_no_build_system_flags(self, temp_env):
|
||||
# Test that both autotools and cmake work getting no build_system flags
|
||||
s1 = spack.spec.Spec("cmake-client").concretized()
|
||||
s1 = spack.concretize.concretized(spack.spec.Spec("cmake-client"))
|
||||
spack.build_environment.setup_package(s1.package, False)
|
||||
|
||||
s2 = spack.spec.Spec("patchelf").concretized()
|
||||
s2 = spack.concretize.concretized(spack.spec.Spec("patchelf"))
|
||||
spack.build_environment.setup_package(s2.package, False)
|
||||
|
||||
# Use cppflags as a canary
|
||||
@ -44,28 +45,28 @@ def test_no_build_system_flags(self, temp_env):
|
||||
def test_unbound_method(self, temp_env):
|
||||
# Other tests test flag_handlers set as bound methods and functions.
|
||||
# This tests an unbound method in python2 (no change in python3).
|
||||
s = spack.spec.Spec("mpileaks cppflags=-g").concretized()
|
||||
s = spack.concretize.concretized(spack.spec.Spec("mpileaks cppflags=-g"))
|
||||
s.package.flag_handler = s.package.__class__.inject_flags
|
||||
spack.build_environment.setup_package(s.package, False)
|
||||
assert os.environ["SPACK_CPPFLAGS"] == "-g"
|
||||
assert "CPPFLAGS" not in os.environ
|
||||
|
||||
def test_inject_flags(self, temp_env):
|
||||
s = spack.spec.Spec("mpileaks cppflags=-g").concretized()
|
||||
s = spack.concretize.concretized(spack.spec.Spec("mpileaks cppflags=-g"))
|
||||
s.package.flag_handler = inject_flags
|
||||
spack.build_environment.setup_package(s.package, False)
|
||||
assert os.environ["SPACK_CPPFLAGS"] == "-g"
|
||||
assert "CPPFLAGS" not in os.environ
|
||||
|
||||
def test_env_flags(self, temp_env):
|
||||
s = spack.spec.Spec("mpileaks cppflags=-g").concretized()
|
||||
s = spack.concretize.concretized(spack.spec.Spec("mpileaks cppflags=-g"))
|
||||
s.package.flag_handler = env_flags
|
||||
spack.build_environment.setup_package(s.package, False)
|
||||
assert os.environ["CPPFLAGS"] == "-g"
|
||||
assert "SPACK_CPPFLAGS" not in os.environ
|
||||
|
||||
def test_build_system_flags_cmake(self, temp_env):
|
||||
s = spack.spec.Spec("cmake-client cppflags=-g").concretized()
|
||||
s = spack.concretize.concretized(spack.spec.Spec("cmake-client cppflags=-g"))
|
||||
s.package.flag_handler = build_system_flags
|
||||
spack.build_environment.setup_package(s.package, False)
|
||||
assert "SPACK_CPPFLAGS" not in os.environ
|
||||
@ -77,7 +78,7 @@ def test_build_system_flags_cmake(self, temp_env):
|
||||
}
|
||||
|
||||
def test_build_system_flags_autotools(self, temp_env):
|
||||
s = spack.spec.Spec("patchelf cppflags=-g").concretized()
|
||||
s = spack.concretize.concretized(spack.spec.Spec("patchelf cppflags=-g"))
|
||||
s.package.flag_handler = build_system_flags
|
||||
spack.build_environment.setup_package(s.package, False)
|
||||
assert "SPACK_CPPFLAGS" not in os.environ
|
||||
@ -86,7 +87,7 @@ def test_build_system_flags_autotools(self, temp_env):
|
||||
|
||||
def test_build_system_flags_not_implemented(self, temp_env):
|
||||
"""Test the command line flags method raises a NotImplementedError"""
|
||||
s = spack.spec.Spec("mpileaks cppflags=-g").concretized()
|
||||
s = spack.concretize.concretized(spack.spec.Spec("mpileaks cppflags=-g"))
|
||||
s.package.flag_handler = build_system_flags
|
||||
try:
|
||||
spack.build_environment.setup_package(s.package, False)
|
||||
@ -95,7 +96,7 @@ def test_build_system_flags_not_implemented(self, temp_env):
|
||||
assert True
|
||||
|
||||
def test_add_build_system_flags_autotools(self, temp_env):
|
||||
s = spack.spec.Spec("patchelf cppflags=-g").concretized()
|
||||
s = spack.concretize.concretized(spack.spec.Spec("patchelf cppflags=-g"))
|
||||
s.package.flag_handler = add_o3_to_build_system_cflags
|
||||
spack.build_environment.setup_package(s.package, False)
|
||||
assert "-g" in os.environ["SPACK_CPPFLAGS"]
|
||||
@ -103,7 +104,7 @@ def test_add_build_system_flags_autotools(self, temp_env):
|
||||
assert s.package.configure_flag_args == ["CFLAGS=-O3"]
|
||||
|
||||
def test_add_build_system_flags_cmake(self, temp_env):
|
||||
s = spack.spec.Spec("cmake-client cppflags=-g").concretized()
|
||||
s = spack.concretize.concretized(spack.spec.Spec("cmake-client cppflags=-g"))
|
||||
s.package.flag_handler = add_o3_to_build_system_cflags
|
||||
spack.build_environment.setup_package(s.package, False)
|
||||
assert "-g" in os.environ["SPACK_CPPFLAGS"]
|
||||
@ -111,7 +112,7 @@ def test_add_build_system_flags_cmake(self, temp_env):
|
||||
assert s.package.cmake_flag_args == ["-DCMAKE_C_FLAGS=-O3"]
|
||||
|
||||
def test_ld_flags_cmake(self, temp_env):
|
||||
s = spack.spec.Spec("cmake-client ldflags=-mthreads").concretized()
|
||||
s = spack.concretize.concretized(spack.spec.Spec("cmake-client ldflags=-mthreads"))
|
||||
s.package.flag_handler = build_system_flags
|
||||
spack.build_environment.setup_package(s.package, False)
|
||||
assert "SPACK_LDFLAGS" not in os.environ
|
||||
@ -123,7 +124,7 @@ def test_ld_flags_cmake(self, temp_env):
|
||||
}
|
||||
|
||||
def test_ld_libs_cmake(self, temp_env):
|
||||
s = spack.spec.Spec("cmake-client ldlibs=-lfoo").concretized()
|
||||
s = spack.concretize.concretized(spack.spec.Spec("cmake-client ldlibs=-lfoo"))
|
||||
s.package.flag_handler = build_system_flags
|
||||
spack.build_environment.setup_package(s.package, False)
|
||||
assert "SPACK_LDLIBS" not in os.environ
|
||||
@ -139,7 +140,7 @@ def test_flag_handler(self, name, flags):
|
||||
flags.append("-foo")
|
||||
return (flags, None, None)
|
||||
|
||||
s = spack.spec.Spec("cmake-client").concretized()
|
||||
s = spack.concretize.concretized(spack.spec.Spec("cmake-client"))
|
||||
s.package.flag_handler = test_flag_handler
|
||||
spack.build_environment.setup_package(s.package, False)
|
||||
|
||||
|
@ -11,6 +11,7 @@
|
||||
|
||||
from llnl.util.filesystem import mkdirp, touch, working_dir
|
||||
|
||||
import spack.concretize
|
||||
import spack.config
|
||||
import spack.error
|
||||
import spack.fetch_strategy
|
||||
@ -186,8 +187,9 @@ def test_adhoc_version_submodules(
|
||||
monkeypatch.setitem(pkg_class.versions, Version("git"), t.args)
|
||||
monkeypatch.setattr(pkg_class, "git", "file://%s" % mock_git_repository.path, raising=False)
|
||||
|
||||
spec = Spec("git-test@{0}".format(mock_git_repository.unversioned_commit))
|
||||
spec.concretize()
|
||||
spec = spack.concretize.concretized(
|
||||
Spec("git-test@{0}".format(mock_git_repository.unversioned_commit))
|
||||
)
|
||||
spec.package.do_stage()
|
||||
collected_fnames = set()
|
||||
for root, dirs, files in os.walk(spec.package.stage.source_path):
|
||||
|
@ -4,6 +4,7 @@
|
||||
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
|
||||
import io
|
||||
|
||||
import spack.concretize
|
||||
import spack.graph
|
||||
import spack.spec
|
||||
|
||||
@ -39,7 +40,7 @@ def test_dynamic_dot_graph_mpileaks(default_mock_concretization):
|
||||
|
||||
def test_ascii_graph_mpileaks(config, mock_packages, monkeypatch):
|
||||
monkeypatch.setattr(spack.graph.AsciiGraph, "_node_label", lambda self, node: node.name)
|
||||
s = spack.spec.Spec("mpileaks").concretized()
|
||||
s = spack.concretize.concretized(spack.spec.Spec("mpileaks"))
|
||||
|
||||
stream = io.StringIO()
|
||||
graph = spack.graph.AsciiGraph()
|
||||
|
@ -9,6 +9,7 @@
|
||||
|
||||
from llnl.util.filesystem import mkdirp, touch, working_dir
|
||||
|
||||
import spack.concretize
|
||||
import spack.config
|
||||
from spack.fetch_strategy import HgFetchStrategy
|
||||
from spack.spec import Spec
|
||||
@ -41,7 +42,7 @@ def test_fetch(type_of_test, secure, mock_hg_repository, config, mutable_mock_re
|
||||
h = mock_hg_repository.hash
|
||||
|
||||
# Construct the package under test
|
||||
s = Spec("hg-test").concretized()
|
||||
s = spack.concretize.concretized(Spec("hg-test"))
|
||||
monkeypatch.setitem(s.package.versions, Version("hg"), t.args)
|
||||
|
||||
# Enter the stage directory and check some properties
|
||||
|
@ -12,6 +12,7 @@
|
||||
import llnl.util.filesystem as fs
|
||||
|
||||
import spack.build_environment
|
||||
import spack.concretize
|
||||
import spack.config
|
||||
import spack.database
|
||||
import spack.error
|
||||
@ -42,7 +43,7 @@ def find_nothing(*args):
|
||||
|
||||
|
||||
def test_install_and_uninstall(install_mockery, mock_fetch, monkeypatch):
|
||||
spec = Spec("trivial-install-test-package").concretized()
|
||||
spec = spack.concretize.concretized(Spec("trivial-install-test-package"))
|
||||
|
||||
PackageInstaller([spec.package], explicit=True).install()
|
||||
assert spec.installed
|
||||
@ -54,7 +55,7 @@ def test_install_and_uninstall(install_mockery, mock_fetch, monkeypatch):
|
||||
@pytest.mark.regression("11870")
|
||||
def test_uninstall_non_existing_package(install_mockery, mock_fetch, monkeypatch):
|
||||
"""Ensure that we can uninstall a package that has been deleted from the repo"""
|
||||
spec = Spec("trivial-install-test-package").concretized()
|
||||
spec = spack.concretize.concretized(Spec("trivial-install-test-package"))
|
||||
|
||||
PackageInstaller([spec.package], explicit=True).install()
|
||||
assert spec.installed
|
||||
@ -72,8 +73,7 @@ def test_uninstall_non_existing_package(install_mockery, mock_fetch, monkeypatch
|
||||
|
||||
def test_pkg_attributes(install_mockery, mock_fetch, monkeypatch):
|
||||
# Get a basic concrete spec for the dummy package.
|
||||
spec = Spec("attributes-foo-app ^attributes-foo")
|
||||
spec.concretize()
|
||||
spec = spack.concretize.concretized(Spec("attributes-foo-app ^attributes-foo"))
|
||||
assert spec.concrete
|
||||
|
||||
pkg = spec.package
|
||||
@ -128,7 +128,7 @@ def remove_prefix(self):
|
||||
|
||||
|
||||
def test_partial_install_delete_prefix_and_stage(install_mockery, mock_fetch, working_env):
|
||||
s = Spec("canfail").concretized()
|
||||
s = spack.concretize.concretized(Spec("canfail"))
|
||||
|
||||
instance_rm_prefix = s.package.remove_prefix
|
||||
|
||||
@ -158,7 +158,7 @@ def test_failing_overwrite_install_should_keep_previous_installation(
|
||||
the original install prefix instead of cleaning it.
|
||||
"""
|
||||
# Do a successful install
|
||||
s = Spec("canfail").concretized()
|
||||
s = spack.concretize.concretized(Spec("canfail"))
|
||||
s.package.set_install_succeed()
|
||||
|
||||
# Do a failing overwrite install
|
||||
@ -174,13 +174,11 @@ def test_failing_overwrite_install_should_keep_previous_installation(
|
||||
|
||||
|
||||
def test_dont_add_patches_to_installed_package(install_mockery, mock_fetch, monkeypatch):
|
||||
dependency = Spec("dependency-install")
|
||||
dependency.concretize()
|
||||
dependency = spack.concretize.concretized(Spec("dependency-install"))
|
||||
PackageInstaller([dependency.package], explicit=True).install()
|
||||
|
||||
dependency_hash = dependency.dag_hash()
|
||||
dependent = Spec("dependent-install ^/" + dependency_hash)
|
||||
dependent.concretize()
|
||||
dependent = spack.concretize.concretized(Spec("dependent-install ^/" + dependency_hash))
|
||||
|
||||
monkeypatch.setitem(
|
||||
dependency.package.patches,
|
||||
@ -192,20 +190,18 @@ def test_dont_add_patches_to_installed_package(install_mockery, mock_fetch, monk
|
||||
|
||||
|
||||
def test_installed_dependency_request_conflicts(install_mockery, mock_fetch, mutable_mock_repo):
|
||||
dependency = Spec("dependency-install")
|
||||
dependency.concretize()
|
||||
dependency = spack.concretize.concretized(Spec("dependency-install"))
|
||||
PackageInstaller([dependency.package], explicit=True).install()
|
||||
|
||||
dependency_hash = dependency.dag_hash()
|
||||
dependent = Spec("conflicting-dependent ^/" + dependency_hash)
|
||||
with pytest.raises(spack.error.UnsatisfiableSpecError):
|
||||
dependent.concretize()
|
||||
spack.concretize.concretized(dependent)
|
||||
|
||||
|
||||
def test_install_dependency_symlinks_pkg(install_mockery, mock_fetch, mutable_mock_repo):
|
||||
"""Test dependency flattening/symlinks mock package."""
|
||||
spec = Spec("flatten-deps")
|
||||
spec.concretize()
|
||||
spec = spack.concretize.concretized(Spec("flatten-deps"))
|
||||
pkg = spec.package
|
||||
PackageInstaller([pkg], explicit=True).install()
|
||||
|
||||
@ -216,7 +212,7 @@ def test_install_dependency_symlinks_pkg(install_mockery, mock_fetch, mutable_mo
|
||||
|
||||
def test_install_times(install_mockery, mock_fetch, mutable_mock_repo):
|
||||
"""Test install times added."""
|
||||
spec = Spec("dev-build-test-install-phases").concretized()
|
||||
spec = spack.concretize.concretized(Spec("dev-build-test-install-phases"))
|
||||
PackageInstaller([spec.package], explicit=True).install()
|
||||
|
||||
# Ensure dependency directory exists after the installation.
|
||||
@ -237,8 +233,7 @@ def test_flatten_deps(install_mockery, mock_fetch, mutable_mock_repo):
|
||||
"""Explicitly test the flattening code for coverage purposes."""
|
||||
# Unfortunately, executing the 'flatten-deps' spec's installation does
|
||||
# not affect code coverage results, so be explicit here.
|
||||
spec = Spec("dependent-install")
|
||||
spec.concretize()
|
||||
spec = spack.concretize.concretized(Spec("dependent-install"))
|
||||
pkg = spec.package
|
||||
PackageInstaller([pkg], explicit=True).install()
|
||||
|
||||
@ -273,7 +268,7 @@ def install_upstream(tmpdir_factory, gen_mock_layout, install_mockery):
|
||||
|
||||
def _install_upstream(*specs):
|
||||
for spec_str in specs:
|
||||
prepared_db.add(Spec(spec_str).concretized())
|
||||
prepared_db.add(spack.concretize.concretized(Spec(spec_str)))
|
||||
downstream_root = str(tmpdir_factory.mktemp("mock_downstream_db_root"))
|
||||
return downstream_root, upstream_layout
|
||||
|
||||
@ -286,8 +281,7 @@ def test_installed_upstream_external(install_upstream, mock_fetch):
|
||||
"""
|
||||
store_root, _ = install_upstream("externaltool")
|
||||
with spack.store.use_store(store_root):
|
||||
dependent = Spec("externaltest")
|
||||
dependent.concretize()
|
||||
dependent = spack.concretize.concretized(Spec("externaltest"))
|
||||
|
||||
new_dependency = dependent["externaltool"]
|
||||
assert new_dependency.external
|
||||
@ -305,8 +299,8 @@ def test_installed_upstream(install_upstream, mock_fetch):
|
||||
"""
|
||||
store_root, upstream_layout = install_upstream("dependency-install")
|
||||
with spack.store.use_store(store_root):
|
||||
dependency = Spec("dependency-install").concretized()
|
||||
dependent = Spec("dependent-install").concretized()
|
||||
dependency = spack.concretize.concretized(Spec("dependency-install"))
|
||||
dependent = spack.concretize.concretized(Spec("dependent-install"))
|
||||
|
||||
new_dependency = dependent["dependency-install"]
|
||||
assert new_dependency.installed_upstream
|
||||
@ -320,7 +314,7 @@ def test_installed_upstream(install_upstream, mock_fetch):
|
||||
|
||||
@pytest.mark.disable_clean_stage_check
|
||||
def test_partial_install_keep_prefix(install_mockery, mock_fetch, monkeypatch, working_env):
|
||||
s = Spec("canfail").concretized()
|
||||
s = spack.concretize.concretized(Spec("canfail"))
|
||||
|
||||
# If remove_prefix is called at any point in this test, that is an error
|
||||
monkeypatch.setattr(spack.package_base.PackageBase, "remove_prefix", mock_remove_prefix)
|
||||
@ -337,7 +331,7 @@ def test_partial_install_keep_prefix(install_mockery, mock_fetch, monkeypatch, w
|
||||
|
||||
|
||||
def test_second_install_no_overwrite_first(install_mockery, mock_fetch, monkeypatch):
|
||||
s = Spec("canfail").concretized()
|
||||
s = spack.concretize.concretized(Spec("canfail"))
|
||||
monkeypatch.setattr(spack.package_base.PackageBase, "remove_prefix", mock_remove_prefix)
|
||||
|
||||
s.package.set_install_succeed()
|
||||
@ -357,8 +351,8 @@ def test_install_prefix_collision_fails(config, mock_fetch, mock_packages, tmpdi
|
||||
projections = {"projections": {"all": "one-prefix-per-package-{name}"}}
|
||||
with spack.store.use_store(str(tmpdir), extra_data=projections):
|
||||
with spack.config.override("config:checksum", False):
|
||||
pkg_a = Spec("libelf@0.8.13").concretized().package
|
||||
pkg_b = Spec("libelf@0.8.12").concretized().package
|
||||
pkg_a = spack.concretize.concretized(Spec("libelf@0.8.13")).package
|
||||
pkg_b = spack.concretize.concretized(Spec("libelf@0.8.12")).package
|
||||
PackageInstaller([pkg_a], explicit=True, fake=True).install()
|
||||
|
||||
with pytest.raises(InstallError, match="Install prefix collision"):
|
||||
@ -366,14 +360,14 @@ def test_install_prefix_collision_fails(config, mock_fetch, mock_packages, tmpdi
|
||||
|
||||
|
||||
def test_store(install_mockery, mock_fetch):
|
||||
spec = Spec("cmake-client").concretized()
|
||||
spec = spack.concretize.concretized(Spec("cmake-client"))
|
||||
pkg = spec.package
|
||||
PackageInstaller([pkg], fake=True, explicit=True).install()
|
||||
|
||||
|
||||
@pytest.mark.disable_clean_stage_check
|
||||
def test_failing_build(install_mockery, mock_fetch, capfd):
|
||||
spec = Spec("failing-build").concretized()
|
||||
spec = spack.concretize.concretized(Spec("failing-build"))
|
||||
pkg = spec.package
|
||||
|
||||
with pytest.raises(spack.build_environment.ChildError, match="Expected failure"):
|
||||
@ -388,8 +382,7 @@ def test_uninstall_by_spec_errors(mutable_database):
|
||||
"""Test exceptional cases with the uninstall command."""
|
||||
|
||||
# Try to uninstall a spec that has not been installed
|
||||
spec = Spec("dependent-install")
|
||||
spec.concretize()
|
||||
spec = spack.concretize.concretized(Spec("dependent-install"))
|
||||
with pytest.raises(InstallError, match="is not installed"):
|
||||
PackageBase.uninstall_by_spec(spec)
|
||||
|
||||
@ -402,7 +395,7 @@ def test_uninstall_by_spec_errors(mutable_database):
|
||||
@pytest.mark.disable_clean_stage_check
|
||||
def test_nosource_pkg_install(install_mockery, mock_fetch, mock_packages, capfd, ensure_debug):
|
||||
"""Test install phases with the nosource package."""
|
||||
spec = Spec("nosource").concretized()
|
||||
spec = spack.concretize.concretized(Spec("nosource"))
|
||||
pkg = spec.package
|
||||
|
||||
# Make sure install works even though there is no associated code.
|
||||
@ -419,7 +412,7 @@ def test_nosource_bundle_pkg_install(
|
||||
install_mockery, mock_fetch, mock_packages, capfd, ensure_debug
|
||||
):
|
||||
"""Test install phases with the nosource-bundle package."""
|
||||
spec = Spec("nosource-bundle").concretized()
|
||||
spec = spack.concretize.concretized(Spec("nosource-bundle"))
|
||||
pkg = spec.package
|
||||
|
||||
# Make sure install works even though there is no associated code.
|
||||
@ -433,7 +426,7 @@ def test_nosource_bundle_pkg_install(
|
||||
|
||||
def test_nosource_pkg_install_post_install(install_mockery, mock_fetch, mock_packages):
|
||||
"""Test install phases with the nosource package with post-install."""
|
||||
spec = Spec("nosource-install").concretized()
|
||||
spec = spack.concretize.concretized(Spec("nosource-install"))
|
||||
pkg = spec.package
|
||||
|
||||
# Make sure both the install and post-install package methods work.
|
||||
@ -450,14 +443,14 @@ def test_nosource_pkg_install_post_install(install_mockery, mock_fetch, mock_pac
|
||||
|
||||
def test_pkg_build_paths(install_mockery):
|
||||
# Get a basic concrete spec for the trivial install package.
|
||||
spec = Spec("trivial-install-test-package").concretized()
|
||||
spec = spack.concretize.concretized(Spec("trivial-install-test-package"))
|
||||
assert spec.package.log_path.endswith(_spack_build_logfile)
|
||||
assert spec.package.env_path.endswith(_spack_build_envfile)
|
||||
|
||||
|
||||
def test_pkg_install_paths(install_mockery):
|
||||
# Get a basic concrete spec for the trivial install package.
|
||||
spec = Spec("trivial-install-test-package").concretized()
|
||||
spec = spack.concretize.concretized(Spec("trivial-install-test-package"))
|
||||
|
||||
log_path = os.path.join(spec.prefix, ".spack", _spack_build_logfile + ".gz")
|
||||
assert spec.package.install_log_path == log_path
|
||||
@ -494,7 +487,7 @@ def test_pkg_install_paths(install_mockery):
|
||||
def test_log_install_without_build_files(install_mockery):
|
||||
"""Test the installer log function when no build files are present."""
|
||||
# Get a basic concrete spec for the trivial install package.
|
||||
spec = Spec("trivial-install-test-package").concretized()
|
||||
spec = spack.concretize.concretized(Spec("trivial-install-test-package"))
|
||||
|
||||
# Attempt installing log without the build log file
|
||||
with pytest.raises(IOError, match="No such file or directory"):
|
||||
@ -516,7 +509,7 @@ def _install(src, dest):
|
||||
|
||||
monkeypatch.setattr(fs, "install", _install)
|
||||
|
||||
spec = Spec("trivial-install-test-package").concretized()
|
||||
spec = spack.concretize.concretized(Spec("trivial-install-test-package"))
|
||||
|
||||
# Set up mock build files and try again to include archive failure
|
||||
log_path = spec.package.log_path
|
||||
@ -588,7 +581,7 @@ def test_empty_install_sanity_check_prefix(
|
||||
monkeypatch, install_mockery, mock_fetch, mock_packages
|
||||
):
|
||||
"""Test empty install triggers sanity_check_prefix."""
|
||||
spec = Spec("failing-empty-install").concretized()
|
||||
spec = spack.concretize.concretized(Spec("failing-empty-install"))
|
||||
with pytest.raises(spack.build_environment.ChildError, match="Nothing was installed"):
|
||||
PackageInstaller([spec.package], explicit=True).install()
|
||||
|
||||
@ -600,7 +593,7 @@ def test_install_from_binary_with_missing_patch_succeeds(
|
||||
pushing the package to a binary cache, installation from that binary cache shouldn't error out
|
||||
because of the missing patch."""
|
||||
# Create a spec s with non-existing patches
|
||||
s = Spec("trivial-install-test-package").concretized()
|
||||
s = spack.concretize.concretized(Spec("trivial-install-test-package"))
|
||||
patches = ["a" * 64]
|
||||
s_dict = s.to_dict()
|
||||
s_dict["spec"]["nodes"][0]["patches"] = patches
|
||||
|
@ -17,6 +17,7 @@
|
||||
import llnl.util.tty as tty
|
||||
|
||||
import spack.binary_distribution
|
||||
import spack.concretize
|
||||
import spack.database
|
||||
import spack.deptypes as dt
|
||||
import spack.error
|
||||
@ -82,7 +83,10 @@ def create_installer(
|
||||
) -> inst.PackageInstaller:
|
||||
"""Create an installer instance for a list of specs or package names that will be
|
||||
concretized."""
|
||||
_specs = [spack.spec.Spec(s).concretized() if isinstance(s, str) else s for s in specs]
|
||||
_specs = [
|
||||
spack.concretize.concretized(spack.spec.Spec(s)) if isinstance(s, str) else s
|
||||
for s in specs
|
||||
]
|
||||
_install_args = {} if install_args is None else install_args
|
||||
return inst.PackageInstaller([spec.package for spec in _specs], **_install_args)
|
||||
|
||||
@ -97,8 +101,7 @@ def test_hms(sec, result):
|
||||
|
||||
def test_get_dependent_ids(install_mockery, mock_packages):
|
||||
# Concretize the parent package, which handle dependency too
|
||||
spec = spack.spec.Spec("pkg-a")
|
||||
spec.concretize()
|
||||
spec = spack.concretize.concretized(spack.spec.Spec("pkg-a"))
|
||||
assert spec.concrete
|
||||
|
||||
pkg_id = inst.package_id(spec)
|
||||
@ -134,8 +137,7 @@ def test_install_msg(monkeypatch):
|
||||
|
||||
def test_install_from_cache_errors(install_mockery):
|
||||
"""Test to ensure cover install from cache errors."""
|
||||
spec = spack.spec.Spec("trivial-install-test-package")
|
||||
spec.concretize()
|
||||
spec = spack.concretize.concretized(spack.spec.Spec("trivial-install-test-package"))
|
||||
assert spec.concrete
|
||||
|
||||
# Check with cache-only
|
||||
@ -154,8 +156,7 @@ def test_install_from_cache_errors(install_mockery):
|
||||
|
||||
def test_install_from_cache_ok(install_mockery, monkeypatch):
|
||||
"""Test to ensure cover _install_from_cache to the return."""
|
||||
spec = spack.spec.Spec("trivial-install-test-package")
|
||||
spec.concretize()
|
||||
spec = spack.concretize.concretized(spack.spec.Spec("trivial-install-test-package"))
|
||||
monkeypatch.setattr(inst, "_try_install_from_binary_cache", _true)
|
||||
monkeypatch.setattr(spack.hooks, "post_install", _noop)
|
||||
|
||||
@ -164,8 +165,7 @@ def test_install_from_cache_ok(install_mockery, monkeypatch):
|
||||
|
||||
def test_process_external_package_module(install_mockery, monkeypatch, capfd):
|
||||
"""Test to simply cover the external module message path."""
|
||||
spec = spack.spec.Spec("trivial-install-test-package")
|
||||
spec.concretize()
|
||||
spec = spack.concretize.concretized(spack.spec.Spec("trivial-install-test-package"))
|
||||
assert spec.concrete
|
||||
|
||||
# Ensure take the external module path WITHOUT any changes to the database
|
||||
@ -192,7 +192,7 @@ def _spec(spec, unsigned=False, mirrors_for_spec=None):
|
||||
# Skip database updates
|
||||
monkeypatch.setattr(spack.database.Database, "add", _noop)
|
||||
|
||||
spec = spack.spec.Spec("pkg-a").concretized()
|
||||
spec = spack.concretize.concretized(spack.spec.Spec("pkg-a"))
|
||||
assert inst._process_binary_cache_tarball(spec.package, explicit=False, unsigned=False)
|
||||
|
||||
out = capfd.readouterr()[0]
|
||||
@ -202,8 +202,7 @@ def _spec(spec, unsigned=False, mirrors_for_spec=None):
|
||||
|
||||
def test_try_install_from_binary_cache(install_mockery, mock_packages, monkeypatch):
|
||||
"""Test return false when no match exists in the mirror"""
|
||||
spec = spack.spec.Spec("mpich")
|
||||
spec.concretize()
|
||||
spec = spack.concretize.concretized(spack.spec.Spec("mpich"))
|
||||
result = inst._try_install_from_binary_cache(spec.package, False, False)
|
||||
assert not result
|
||||
|
||||
@ -275,7 +274,7 @@ def _mock_installed(self):
|
||||
|
||||
|
||||
def test_check_before_phase_error(install_mockery):
|
||||
s = spack.spec.Spec("trivial-install-test-package").concretized()
|
||||
s = spack.concretize.concretized(spack.spec.Spec("trivial-install-test-package"))
|
||||
s.package.stop_before_phase = "beforephase"
|
||||
with pytest.raises(inst.BadInstallPhase) as exc_info:
|
||||
inst._check_last_phase(s.package)
|
||||
@ -286,7 +285,7 @@ def test_check_before_phase_error(install_mockery):
|
||||
|
||||
|
||||
def test_check_last_phase_error(install_mockery):
|
||||
s = spack.spec.Spec("trivial-install-test-package").concretized()
|
||||
s = spack.concretize.concretized(spack.spec.Spec("trivial-install-test-package"))
|
||||
s.package.stop_before_phase = None
|
||||
s.package.last_phase = "badphase"
|
||||
with pytest.raises(inst.BadInstallPhase) as exc_info:
|
||||
@ -421,15 +420,13 @@ def test_package_id_err(install_mockery):
|
||||
|
||||
|
||||
def test_package_id_ok(install_mockery):
|
||||
spec = spack.spec.Spec("trivial-install-test-package")
|
||||
spec.concretize()
|
||||
spec = spack.concretize.concretized(spack.spec.Spec("trivial-install-test-package"))
|
||||
assert spec.concrete
|
||||
assert spec.name in inst.package_id(spec)
|
||||
|
||||
|
||||
def test_fake_install(install_mockery):
|
||||
spec = spack.spec.Spec("trivial-install-test-package")
|
||||
spec.concretize()
|
||||
spec = spack.concretize.concretized(spack.spec.Spec("trivial-install-test-package"))
|
||||
assert spec.concrete
|
||||
|
||||
pkg = spec.package
|
||||
@ -441,7 +438,7 @@ def test_dump_packages_deps_ok(install_mockery, tmpdir, mock_packages):
|
||||
"""Test happy path for dump_packages with dependencies."""
|
||||
|
||||
spec_name = "simple-inheritance"
|
||||
spec = spack.spec.Spec(spec_name).concretized()
|
||||
spec = spack.concretize.concretized(spack.spec.Spec(spec_name))
|
||||
inst.dump_packages(spec, str(tmpdir))
|
||||
|
||||
repo = mock_packages.repos[0]
|
||||
@ -472,7 +469,7 @@ def _repoerr(repo, name):
|
||||
# the try-except block
|
||||
monkeypatch.setattr(spack.store.STORE.layout, "build_packages_path", bpp_path)
|
||||
|
||||
spec = spack.spec.Spec("simple-inheritance").concretized()
|
||||
spec = spack.concretize.concretized(spack.spec.Spec("simple-inheritance"))
|
||||
path = str(tmpdir)
|
||||
|
||||
# The call to install_tree will raise the exception since not mocking
|
||||
@ -582,7 +579,7 @@ def test_check_deps_status_install_failure(install_mockery):
|
||||
"""Tests that checking the dependency status on a request to install
|
||||
'a' fails, if we mark the dependency as failed.
|
||||
"""
|
||||
s = spack.spec.Spec("pkg-a").concretized()
|
||||
s = spack.concretize.concretized(spack.spec.Spec("pkg-a"))
|
||||
for dep in s.traverse(root=False):
|
||||
spack.store.STORE.failure_tracker.mark(dep)
|
||||
|
||||
@ -655,8 +652,8 @@ def test_installer_init_requests(install_mockery):
|
||||
@pytest.mark.parametrize("transitive", [True, False])
|
||||
def test_install_spliced(install_mockery, mock_fetch, monkeypatch, capsys, transitive):
|
||||
"""Test installing a spliced spec"""
|
||||
spec = spack.spec.Spec("splice-t").concretized()
|
||||
dep = spack.spec.Spec("splice-h+foo").concretized()
|
||||
spec = spack.concretize.concretized(spack.spec.Spec("splice-t"))
|
||||
dep = spack.concretize.concretized(spack.spec.Spec("splice-h+foo"))
|
||||
|
||||
# Do the splice.
|
||||
out = spec.splice(dep, transitive)
|
||||
@ -670,8 +667,8 @@ def test_install_spliced(install_mockery, mock_fetch, monkeypatch, capsys, trans
|
||||
@pytest.mark.parametrize("transitive", [True, False])
|
||||
def test_install_spliced_build_spec_installed(install_mockery, capfd, mock_fetch, transitive):
|
||||
"""Test installing a spliced spec with the build spec already installed"""
|
||||
spec = spack.spec.Spec("splice-t").concretized()
|
||||
dep = spack.spec.Spec("splice-h+foo").concretized()
|
||||
spec = spack.concretize.concretized(spack.spec.Spec("splice-t"))
|
||||
dep = spack.concretize.concretized(spack.spec.Spec("splice-h+foo"))
|
||||
|
||||
# Do the splice.
|
||||
out = spec.splice(dep, transitive)
|
||||
@ -697,8 +694,8 @@ def test_install_splice_root_from_binary(
|
||||
):
|
||||
"""Test installing a spliced spec with the root available in binary cache"""
|
||||
# Test splicing and rewiring a spec with the same name, different hash.
|
||||
original_spec = spack.spec.Spec(root_str).concretized()
|
||||
spec_to_splice = spack.spec.Spec("splice-h+foo").concretized()
|
||||
original_spec = spack.concretize.concretized(spack.spec.Spec(root_str))
|
||||
spec_to_splice = spack.concretize.concretized(spack.spec.Spec("splice-h+foo"))
|
||||
|
||||
PackageInstaller([original_spec.package, spec_to_splice.package]).install()
|
||||
|
||||
@ -854,7 +851,7 @@ def _chgrp(path, group, follow_symlinks=True):
|
||||
monkeypatch.setattr(fs, "chgrp", _chgrp)
|
||||
|
||||
build_task = create_build_task(
|
||||
spack.spec.Spec("trivial-install-test-package").concretized().package
|
||||
spack.concretize.concretized(spack.spec.Spec("trivial-install-test-package")).package
|
||||
)
|
||||
spec = build_task.request.pkg.spec
|
||||
|
||||
@ -1025,7 +1022,8 @@ def test_install_fail_multi(install_mockery, mock_fetch, monkeypatch):
|
||||
|
||||
def test_install_fail_fast_on_detect(install_mockery, monkeypatch, capsys):
|
||||
"""Test fail_fast install when an install failure is detected."""
|
||||
b, c = spack.spec.Spec("pkg-b").concretized(), spack.spec.Spec("pkg-c").concretized()
|
||||
b = spack.concretize.concretized(spack.spec.Spec("pkg-b"))
|
||||
c = spack.concretize.concretized(spack.spec.Spec("pkg-c"))
|
||||
b_id, c_id = inst.package_id(b), inst.package_id(c)
|
||||
|
||||
installer = create_installer([b, c], {"fail_fast": True})
|
||||
@ -1094,7 +1092,7 @@ def _requeued(installer, task, install_status):
|
||||
|
||||
def test_install_lock_installed_requeue(install_mockery, monkeypatch, capfd):
|
||||
"""Cover basic install handling for installed package."""
|
||||
b = spack.spec.Spec("pkg-b").concretized()
|
||||
b = spack.concretize.concretized(spack.spec.Spec("pkg-b"))
|
||||
b_pkg_id = inst.package_id(b)
|
||||
installer = create_installer([b])
|
||||
|
||||
@ -1280,7 +1278,7 @@ def test_term_status_line():
|
||||
@pytest.mark.parametrize("explicit", [True, False])
|
||||
def test_single_external_implicit_install(install_mockery, explicit):
|
||||
pkg = "trivial-install-test-package"
|
||||
s = spack.spec.Spec(pkg).concretized()
|
||||
s = spack.concretize.concretized(spack.spec.Spec(pkg))
|
||||
s.external_path = "/usr"
|
||||
args = {"explicit": [s.dag_hash()] if explicit else []}
|
||||
create_installer([s], args).install()
|
||||
@ -1289,7 +1287,7 @@ def test_single_external_implicit_install(install_mockery, explicit):
|
||||
|
||||
def test_overwrite_install_does_install_build_deps(install_mockery, mock_fetch):
|
||||
"""When overwrite installing something from sources, build deps should be installed."""
|
||||
s = spack.spec.Spec("dtrun3").concretized()
|
||||
s = spack.concretize.concretized(spack.spec.Spec("dtrun3"))
|
||||
create_installer([s]).install()
|
||||
|
||||
# Verify there is a pure build dep
|
||||
@ -1311,7 +1309,7 @@ def test_overwrite_install_does_install_build_deps(install_mockery, mock_fetch):
|
||||
def test_print_install_test_log_skipped(install_mockery, mock_packages, capfd, run_tests):
|
||||
"""Confirm printing of install log skipped if not run/no failures."""
|
||||
name = "trivial-install-test-package"
|
||||
s = spack.spec.Spec(name).concretized()
|
||||
s = spack.concretize.concretized(spack.spec.Spec(name))
|
||||
pkg = s.package
|
||||
|
||||
pkg.run_tests = run_tests
|
||||
@ -1325,7 +1323,7 @@ def test_print_install_test_log_failures(
|
||||
):
|
||||
"""Confirm expected outputs when there are test failures."""
|
||||
name = "trivial-install-test-package"
|
||||
s = spack.spec.Spec(name).concretized()
|
||||
s = spack.concretize.concretized(spack.spec.Spec(name))
|
||||
pkg = s.package
|
||||
|
||||
# Missing test log is an error
|
||||
|
@ -12,6 +12,7 @@
|
||||
from llnl.util.symlink import resolve_link_target_relative_to_the_link
|
||||
|
||||
import spack.caches
|
||||
import spack.concretize
|
||||
import spack.config
|
||||
import spack.fetch_strategy
|
||||
import spack.mirrors.layout
|
||||
@ -44,7 +45,7 @@ def set_up_package(name, repository, url_attr):
|
||||
2. Point the package's version args at that repo.
|
||||
"""
|
||||
# Set up packages to point at mock repos.
|
||||
s = Spec(name).concretized()
|
||||
s = spack.concretize.concretized(Spec(name))
|
||||
repos[name] = repository
|
||||
|
||||
# change the fetch args of the first (only) version.
|
||||
@ -61,7 +62,7 @@ def check_mirror():
|
||||
mirrors = {"spack-mirror-test": url_util.path_to_file_url(mirror_root)}
|
||||
with spack.config.override("mirrors", mirrors):
|
||||
with spack.config.override("config:checksum", False):
|
||||
specs = [Spec(x).concretized() for x in repos]
|
||||
specs = [spack.concretize.concretized(Spec(x)) for x in repos]
|
||||
spack.mirrors.utils.create(mirror_root, specs)
|
||||
|
||||
# Stage directory exists
|
||||
@ -78,7 +79,7 @@ def check_mirror():
|
||||
|
||||
# Now try to fetch each package.
|
||||
for name, mock_repo in repos.items():
|
||||
spec = Spec(name).concretized()
|
||||
spec = spack.concretize.concretized(Spec(name))
|
||||
pkg = spec.package
|
||||
|
||||
with spack.config.override("config:checksum", False):
|
||||
@ -213,13 +214,13 @@ def test_invalid_json_mirror_collection(invalid_json, error_message):
|
||||
|
||||
|
||||
def test_mirror_archive_paths_no_version(mock_packages, mock_archive):
|
||||
spec = Spec("trivial-install-test-package@=nonexistingversion").concretized()
|
||||
spec = spack.concretize.concretized(Spec("trivial-install-test-package@=nonexistingversion"))
|
||||
fetcher = spack.fetch_strategy.URLFetchStrategy(url=mock_archive.url)
|
||||
spack.mirrors.layout.default_mirror_layout(fetcher, "per-package-ref", spec)
|
||||
|
||||
|
||||
def test_mirror_with_url_patches(mock_packages, monkeypatch):
|
||||
spec = Spec("patch-several-dependencies").concretized()
|
||||
spec = spack.concretize.concretized(Spec("patch-several-dependencies"))
|
||||
files_cached_in_mirror = set()
|
||||
|
||||
def record_store(_class, fetcher, relative_dst, cosmetic_path=None):
|
||||
|
@ -10,6 +10,7 @@
|
||||
from llnl.util.symlink import readlink
|
||||
|
||||
import spack.cmd.modules
|
||||
import spack.concretize
|
||||
import spack.config
|
||||
import spack.error
|
||||
import spack.modules
|
||||
@ -61,7 +62,7 @@ def mock_package_perms(monkeypatch):
|
||||
def test_modules_written_with_proper_permissions(
|
||||
mock_module_filename, mock_package_perms, mock_packages, config
|
||||
):
|
||||
spec = spack.spec.Spec("mpileaks").concretized()
|
||||
spec = spack.concretize.concretized(spack.spec.Spec("mpileaks"))
|
||||
|
||||
# The code tested is common to all module types, but has to be tested from
|
||||
# one. Tcl picked at random
|
||||
@ -75,7 +76,7 @@ def test_modules_written_with_proper_permissions(
|
||||
def test_modules_default_symlink(
|
||||
module_type, mock_packages, mock_module_filename, mock_module_defaults, config
|
||||
):
|
||||
spec = spack.spec.Spec("mpileaks@2.3").concretized()
|
||||
spec = spack.concretize.concretized(spack.spec.Spec("mpileaks@2.3"))
|
||||
mock_module_defaults(spec.format("{name}{@version}"), True)
|
||||
|
||||
generator_cls = spack.modules.module_types[module_type]
|
||||
@ -181,7 +182,7 @@ def test_get_module_upstream():
|
||||
@pytest.mark.regression("14347")
|
||||
def test_load_installed_package_not_in_repo(install_mockery, mock_fetch, monkeypatch):
|
||||
"""Test that installed packages that have been removed are still loadable"""
|
||||
spec = Spec("trivial-install-test-package").concretized()
|
||||
spec = spack.concretize.concretized(Spec("trivial-install-test-package"))
|
||||
PackageInstaller([spec.package], explicit=True).install()
|
||||
spack.modules.module_types["tcl"](spec, "default", True).write()
|
||||
|
||||
|
@ -6,6 +6,7 @@
|
||||
|
||||
import pytest
|
||||
|
||||
import spack.concretize
|
||||
import spack.modules.lmod
|
||||
import spack.modules.tcl
|
||||
import spack.spec
|
||||
@ -19,7 +20,7 @@ def modulefile_content(request):
|
||||
def _impl(spec_like, module_set_name="default", explicit=True):
|
||||
if isinstance(spec_like, str):
|
||||
spec_like = spack.spec.Spec(spec_like)
|
||||
spec = spec_like.concretized()
|
||||
spec = spack.concretize.concretized(spec_like)
|
||||
generator = writer_cls(spec, module_set_name, explicit)
|
||||
generator.write(overwrite=True)
|
||||
written_module = pathlib.Path(generator.layout.filename)
|
||||
@ -36,7 +37,7 @@ def factory(request, mock_modules_root):
|
||||
writer_cls = getattr(request.module, "writer_cls")
|
||||
|
||||
def _mock(spec_string, module_set_name="default", explicit=True):
|
||||
spec = spack.spec.Spec(spec_string).concretized()
|
||||
spec = spack.concretize.concretized(spack.spec.Spec(spec_string))
|
||||
return writer_cls(spec, module_set_name, explicit), spec
|
||||
|
||||
return _mock
|
||||
|
@ -9,6 +9,7 @@
|
||||
|
||||
import archspec.cpu
|
||||
|
||||
import spack.concretize
|
||||
import spack.config
|
||||
import spack.environment as ev
|
||||
import spack.main
|
||||
@ -436,7 +437,7 @@ def test_modules_relative_to_view(
|
||||
module_configuration("with_view")
|
||||
install("--add", "cmake")
|
||||
|
||||
spec = spack.spec.Spec("cmake").concretized()
|
||||
spec = spack.concretize.concretized(spack.spec.Spec("cmake"))
|
||||
|
||||
content = modulefile_content("cmake")
|
||||
expected = e.default_view.get_projection_for_spec(spec)
|
||||
@ -456,7 +457,7 @@ def test_hide_implicits(self, module_configuration, temporary_store):
|
||||
"""Tests the addition and removal of hide command in modulerc."""
|
||||
module_configuration("hide_implicits")
|
||||
|
||||
spec = spack.spec.Spec("mpileaks@2.3").concretized()
|
||||
spec = spack.concretize.concretized(spack.spec.Spec("mpileaks@2.3"))
|
||||
|
||||
# mpileaks is defined as implicit, thus hide command should appear in modulerc
|
||||
writer = writer_cls(spec, "default", False)
|
||||
@ -508,8 +509,8 @@ def test_hide_implicits(self, module_configuration, temporary_store):
|
||||
# three versions of mpileaks are implicit
|
||||
writer = writer_cls(spec, "default", False)
|
||||
writer.write(overwrite=True)
|
||||
spec_alt1 = spack.spec.Spec("mpileaks@2.2").concretized()
|
||||
spec_alt2 = spack.spec.Spec("mpileaks@2.1").concretized()
|
||||
spec_alt1 = spack.concretize.concretized(spack.spec.Spec("mpileaks@2.2"))
|
||||
spec_alt2 = spack.concretize.concretized(spack.spec.Spec("mpileaks@2.1"))
|
||||
writer_alt1 = writer_cls(spec_alt1, "default", False)
|
||||
writer_alt1.write(overwrite=True)
|
||||
writer_alt2 = writer_cls(spec_alt2, "default", False)
|
||||
|
@ -9,6 +9,7 @@
|
||||
|
||||
import archspec.cpu
|
||||
|
||||
import spack.concretize
|
||||
import spack.modules.common
|
||||
import spack.modules.tcl
|
||||
import spack.spec
|
||||
@ -394,8 +395,7 @@ def test_setup_environment(self, modulefile_content, module_configuration):
|
||||
assert len([x for x in content if "setenv FOOBAR" in x]) == 1
|
||||
assert len([x for x in content if "setenv FOOBAR {mpileaks}" in x]) == 1
|
||||
|
||||
spec = spack.spec.Spec("mpileaks")
|
||||
spec.concretize()
|
||||
spec = spack.concretize.concretized(spack.spec.Spec("mpileaks"))
|
||||
content = modulefile_content(spec["callpath"])
|
||||
|
||||
assert len([x for x in content if "setenv FOOBAR" in x]) == 1
|
||||
@ -469,14 +469,12 @@ def test_hide_implicits_with_arg(self, module_configuration):
|
||||
module_configuration("exclude_implicits")
|
||||
|
||||
# mpileaks is defined as explicit with explicit argument set on writer
|
||||
mpileaks_spec = spack.spec.Spec("mpileaks")
|
||||
mpileaks_spec.concretize()
|
||||
mpileaks_spec = spack.concretize.concretized(spack.spec.Spec("mpileaks"))
|
||||
writer = writer_cls(mpileaks_spec, "default", True)
|
||||
assert not writer.conf.excluded
|
||||
|
||||
# callpath is defined as implicit with explicit argument set on writer
|
||||
callpath_spec = spack.spec.Spec("callpath")
|
||||
callpath_spec.concretize()
|
||||
callpath_spec = spack.concretize.concretized(spack.spec.Spec("callpath"))
|
||||
writer = writer_cls(callpath_spec, "default", False)
|
||||
assert writer.conf.excluded
|
||||
|
||||
@ -511,7 +509,7 @@ def test_hide_implicits(self, module_configuration, temporary_store):
|
||||
"""Tests the addition and removal of hide command in modulerc."""
|
||||
module_configuration("hide_implicits")
|
||||
|
||||
spec = spack.spec.Spec("mpileaks@2.3").concretized()
|
||||
spec = spack.concretize.concretized(spack.spec.Spec("mpileaks@2.3"))
|
||||
|
||||
# mpileaks is defined as implicit, thus hide command should appear in modulerc
|
||||
writer = writer_cls(spec, "default", False)
|
||||
@ -558,8 +556,8 @@ def test_hide_implicits(self, module_configuration, temporary_store):
|
||||
# three versions of mpileaks are implicit
|
||||
writer = writer_cls(spec, "default", False)
|
||||
writer.write(overwrite=True)
|
||||
spec_alt1 = spack.spec.Spec("mpileaks@2.2").concretized()
|
||||
spec_alt2 = spack.spec.Spec("mpileaks@2.1").concretized()
|
||||
spec_alt1 = spack.concretize.concretized(spack.spec.Spec("mpileaks@2.2"))
|
||||
spec_alt2 = spack.concretize.concretized(spack.spec.Spec("mpileaks@2.1"))
|
||||
writer_alt1 = writer_cls(spec_alt1, "default", False)
|
||||
writer_alt1.write(overwrite=True)
|
||||
writer_alt2 = writer_cls(spec_alt2, "default", False)
|
||||
|
@ -7,6 +7,7 @@
|
||||
|
||||
import pytest
|
||||
|
||||
import spack.concretize
|
||||
import spack.config
|
||||
import spack.platforms
|
||||
import spack.spec
|
||||
@ -29,7 +30,7 @@ def pkg_name(request):
|
||||
|
||||
|
||||
def test_no_version_match(pkg_name):
|
||||
spec = spack.spec.Spec(pkg_name + "@2.0").concretized()
|
||||
spec = spack.concretize.concretized(spack.spec.Spec(pkg_name + "@2.0"))
|
||||
with pytest.raises(NoSuchMethodError):
|
||||
spec.package.no_version_2()
|
||||
|
||||
@ -75,7 +76,7 @@ def test_multimethod_calls(
|
||||
with spack.config.override(
|
||||
"compilers", [compiler_factory(spec="apple-clang@9.1.0", operating_system="elcapitan")]
|
||||
):
|
||||
s = spack.spec.Spec(pkg_name + constraint_str).concretized()
|
||||
s = spack.concretize.concretized(spack.spec.Spec(pkg_name + constraint_str))
|
||||
msg = f"Method {method_name} from {s} is giving a wrong result"
|
||||
assert getattr(s.package, method_name)() == expected_result, msg
|
||||
|
||||
@ -84,10 +85,10 @@ def test_target_match(pkg_name):
|
||||
platform = spack.platforms.host()
|
||||
targets = list(platform.targets.values())
|
||||
for target in targets[:-1]:
|
||||
s = spack.spec.Spec(pkg_name + " target=" + target.name).concretized()
|
||||
s = spack.concretize.concretized(spack.spec.Spec(pkg_name + " target=" + target.name))
|
||||
assert s.package.different_by_target() == target.name
|
||||
|
||||
s = spack.spec.Spec(pkg_name + " target=" + targets[-1].name).concretized()
|
||||
s = spack.concretize.concretized(spack.spec.Spec(pkg_name + " target=" + targets[-1].name))
|
||||
if len(targets) == 1:
|
||||
assert s.package.different_by_target() == targets[-1].name
|
||||
else:
|
||||
@ -117,5 +118,5 @@ def test_target_match(pkg_name):
|
||||
],
|
||||
)
|
||||
def test_multimethod_calls_and_inheritance(spec_str, method_name, expected_result):
|
||||
s = spack.spec.Spec(spec_str).concretized()
|
||||
s = spack.concretize.concretized(spack.spec.Spec(spec_str))
|
||||
assert getattr(s.package, method_name)() == expected_result
|
||||
|
@ -5,6 +5,7 @@
|
||||
|
||||
import pytest
|
||||
|
||||
import spack.concretize
|
||||
from spack.spec import Spec
|
||||
|
||||
|
||||
@ -73,14 +74,11 @@ def spec_and_expected(request):
|
||||
|
||||
|
||||
def test_default_variant(config, mock_packages):
|
||||
spec = Spec("optional-dep-test-3")
|
||||
spec.concretize()
|
||||
spec = spack.concretize.concretized(Spec("optional-dep-test-3"))
|
||||
assert "pkg-a" in spec
|
||||
|
||||
spec = Spec("optional-dep-test-3~var")
|
||||
spec.concretize()
|
||||
spec = spack.concretize.concretized(Spec("optional-dep-test-3~var"))
|
||||
assert "pkg-a" in spec
|
||||
|
||||
spec = Spec("optional-dep-test-3+var")
|
||||
spec.concretize()
|
||||
spec = spack.concretize.concretized(Spec("optional-dep-test-3+var"))
|
||||
assert "pkg-b" in spec
|
||||
|
@ -18,6 +18,7 @@
|
||||
import llnl.util.filesystem as fs
|
||||
|
||||
import spack.compilers
|
||||
import spack.concretize
|
||||
import spack.deptypes as dt
|
||||
import spack.error
|
||||
import spack.install_test
|
||||
@ -167,8 +168,7 @@ def setup_install_test(source_paths, test_root):
|
||||
)
|
||||
def test_cache_extra_sources(install_mockery, spec, sources, extras, expect):
|
||||
"""Test the package's cache extra test sources helper function."""
|
||||
s = spack.spec.Spec(spec).concretized()
|
||||
s.package.spec.concretize()
|
||||
s = spack.concretize.concretized(spack.spec.Spec(spec))
|
||||
|
||||
source_path = s.package.stage.source_path
|
||||
srcs = [fs.join_path(source_path, src) for src in sources]
|
||||
@ -206,8 +206,7 @@ def test_cache_extra_sources(install_mockery, spec, sources, extras, expect):
|
||||
|
||||
|
||||
def test_cache_extra_sources_fails(install_mockery):
|
||||
s = spack.spec.Spec("pkg-a").concretized()
|
||||
s.package.spec.concretize()
|
||||
s = spack.concretize.concretized(spack.spec.Spec("pkg-a"))
|
||||
|
||||
with pytest.raises(InstallError) as exc_info:
|
||||
spack.install_test.cache_extra_test_sources(s.package, ["/a/b", "no-such-file"])
|
||||
|
@ -8,6 +8,7 @@
|
||||
import pytest
|
||||
|
||||
import spack.build_systems.cmake as cmake
|
||||
import spack.concretize
|
||||
import spack.directives
|
||||
import spack.error
|
||||
import spack.fetch_strategy
|
||||
@ -76,13 +77,13 @@ def test_inheritance_of_directives(self):
|
||||
assert len(pkg_cls.provided) == 2
|
||||
|
||||
# Check that Spec instantiation behaves as we expect
|
||||
s = Spec("simple-inheritance").concretized()
|
||||
s = spack.concretize.concretized(Spec("simple-inheritance"))
|
||||
assert "^cmake" in s
|
||||
assert "^openblas" in s
|
||||
assert "+openblas" in s
|
||||
assert "mpi" in s
|
||||
|
||||
s = Spec("simple-inheritance~openblas").concretized()
|
||||
s = spack.concretize.concretized(Spec("simple-inheritance~openblas"))
|
||||
assert "^cmake" in s
|
||||
assert "^openblas" not in s
|
||||
assert "~openblas" in s
|
||||
@ -90,9 +91,8 @@ def test_inheritance_of_directives(self):
|
||||
|
||||
@pytest.mark.regression("11844")
|
||||
def test_inheritance_of_patches(self):
|
||||
s = Spec("patch-inheritance")
|
||||
# Will error if inheritor package cannot find inherited patch files
|
||||
s.concretize()
|
||||
_ = spack.concretize.concretized(Spec("patch-inheritance"))
|
||||
|
||||
def test_import_class_from_package(self):
|
||||
from spack.pkg.builtin.mock.mpich import Mpich # noqa: F401
|
||||
@ -116,7 +116,7 @@ def test_import_namespace_container_modules(self):
|
||||
def test_urls_for_versions(mock_packages, config):
|
||||
"""Version directive without a 'url' argument should use default url."""
|
||||
for spec_str in ("url_override@0.9.0", "url_override@1.0.0"):
|
||||
s = Spec(spec_str).concretized()
|
||||
s = spack.concretize.concretized(Spec(spec_str))
|
||||
url = s.package.url_for_version("0.9.0")
|
||||
assert url == "http://www.anothersite.org/uo-0.9.0.tgz"
|
||||
|
||||
@ -138,7 +138,7 @@ def test_url_for_version_with_no_urls(mock_packages, config):
|
||||
|
||||
|
||||
def test_custom_cmake_prefix_path(mock_packages, config):
|
||||
spec = Spec("depends-on-define-cmake-prefix-paths").concretized()
|
||||
spec = spack.concretize.concretized(Spec("depends-on-define-cmake-prefix-paths"))
|
||||
|
||||
assert cmake.get_cmake_prefix_path(spec.package) == [
|
||||
spec["define-cmake-prefix-paths"].prefix.test
|
||||
@ -146,7 +146,7 @@ def test_custom_cmake_prefix_path(mock_packages, config):
|
||||
|
||||
|
||||
def test_url_for_version_with_only_overrides(mock_packages, config):
|
||||
s = Spec("url-only-override").concretized()
|
||||
s = spack.concretize.concretized(Spec("url-only-override"))
|
||||
|
||||
# these exist and should just take the URL provided in the package
|
||||
assert s.package.url_for_version("1.0.0") == "http://a.example.com/url_override-1.0.0.tar.gz"
|
||||
@ -161,7 +161,7 @@ def test_url_for_version_with_only_overrides(mock_packages, config):
|
||||
|
||||
|
||||
def test_url_for_version_with_only_overrides_with_gaps(mock_packages, config):
|
||||
s = Spec("url-only-override-with-gaps").concretized()
|
||||
s = spack.concretize.concretized(Spec("url-only-override-with-gaps"))
|
||||
|
||||
# same as for url-only-override -- these are specific
|
||||
assert s.package.url_for_version("1.0.0") == "http://a.example.com/url_override-1.0.0.tar.gz"
|
||||
|
@ -21,6 +21,7 @@
|
||||
|
||||
import spack.binary_distribution as bindist
|
||||
import spack.cmd.buildcache as buildcache
|
||||
import spack.concretize
|
||||
import spack.config
|
||||
import spack.error
|
||||
import spack.fetch_strategy
|
||||
@ -49,7 +50,7 @@
|
||||
@pytest.mark.usefixtures("install_mockery", "mock_gnupghome")
|
||||
def test_buildcache(mock_archive, tmp_path, monkeypatch, mutable_config):
|
||||
# Install a test package
|
||||
spec = Spec("trivial-install-test-package").concretized()
|
||||
spec = spack.concretize.concretized(Spec("trivial-install-test-package"))
|
||||
monkeypatch.setattr(spec.package, "fetcher", URLFetchStrategy(url=mock_archive.url))
|
||||
PackageInstaller([spec.package], explicit=True).install()
|
||||
pkghash = "/" + str(spec.dag_hash(7))
|
||||
|
@ -13,6 +13,7 @@
|
||||
|
||||
from llnl.util.filesystem import mkdirp, touch, working_dir
|
||||
|
||||
import spack.concretize
|
||||
import spack.error
|
||||
import spack.fetch_strategy
|
||||
import spack.patch
|
||||
@ -92,7 +93,7 @@ def mock_patch_stage(tmpdir_factory, monkeypatch):
|
||||
def test_url_patch(mock_patch_stage, filename, sha256, archive_sha256, config):
|
||||
# Make a patch object
|
||||
url = url_util.path_to_file_url(filename)
|
||||
s = Spec("patch").concretized()
|
||||
s = spack.concretize.concretized(Spec("patch"))
|
||||
|
||||
# make a stage
|
||||
with Stage(url) as stage: # TODO: url isn't used; maybe refactor Stage
|
||||
@ -146,8 +147,7 @@ def test_url_patch(mock_patch_stage, filename, sha256, archive_sha256, config):
|
||||
|
||||
def test_patch_in_spec(mock_packages, config):
|
||||
"""Test whether patches in a package appear in the spec."""
|
||||
spec = Spec("patch")
|
||||
spec.concretize()
|
||||
spec = spack.concretize.concretized(Spec("patch"))
|
||||
assert "patches" in list(spec.variants.keys())
|
||||
|
||||
# Here the order is bar, foo, baz. Note that MV variants order
|
||||
@ -165,18 +165,15 @@ def test_patch_mixed_versions_subset_constraint(mock_packages, config):
|
||||
a patch applied to a version range of x.y.z versions is not applied to
|
||||
an x.y version.
|
||||
"""
|
||||
spec1 = Spec("patch@1.0.1")
|
||||
spec1.concretize()
|
||||
spec1 = spack.concretize.concretized(Spec("patch@1.0.1"))
|
||||
assert biz_sha256 in spec1.variants["patches"].value
|
||||
|
||||
spec2 = Spec("patch@=1.0")
|
||||
spec2.concretize()
|
||||
spec2 = spack.concretize.concretized(Spec("patch@=1.0"))
|
||||
assert biz_sha256 not in spec2.variants["patches"].value
|
||||
|
||||
|
||||
def test_patch_order(mock_packages, config):
|
||||
spec = Spec("dep-diamond-patch-top")
|
||||
spec.concretize()
|
||||
spec = spack.concretize.concretized(Spec("dep-diamond-patch-top"))
|
||||
|
||||
mid2_sha256 = (
|
||||
"mid21234abcd1234abcd1234abcd1234abcd1234abcd1234abcd1234abcd1234"
|
||||
@ -234,8 +231,7 @@ def test_nested_directives(mock_packages):
|
||||
@pytest.mark.not_on_windows("Test requires Autotools")
|
||||
def test_patched_dependency(mock_packages, install_mockery, mock_fetch):
|
||||
"""Test whether patched dependencies work."""
|
||||
spec = Spec("patch-a-dependency")
|
||||
spec.concretize()
|
||||
spec = spack.concretize.concretized(Spec("patch-a-dependency"))
|
||||
assert "patches" in list(spec["libelf"].variants.keys())
|
||||
|
||||
# make sure the patch makes it into the dependency spec
|
||||
@ -275,8 +271,7 @@ def test_patch_failure_develop_spec_exits_gracefully(
|
||||
):
|
||||
"""ensure that a failing patch does not trigger exceptions for develop specs"""
|
||||
|
||||
spec = Spec(f"patch-a-dependency ^libelf dev_path={tmpdir}")
|
||||
spec.concretize()
|
||||
spec = spack.concretize.concretized(Spec(f"patch-a-dependency ^libelf dev_path={tmpdir}"))
|
||||
libelf = spec["libelf"]
|
||||
assert "patches" in list(libelf.variants.keys())
|
||||
pkg = libelf.package
|
||||
@ -292,8 +287,7 @@ def test_patch_failure_restages(mock_packages, install_mockery, mock_fetch):
|
||||
ensure that a failing patch does not trigger exceptions
|
||||
for non-develop specs and the source gets restaged
|
||||
"""
|
||||
spec = Spec("patch-a-dependency")
|
||||
spec.concretize()
|
||||
spec = spack.concretize.concretized(Spec("patch-a-dependency"))
|
||||
pkg = spec["libelf"].package
|
||||
with pkg.stage:
|
||||
bad_patch_indicator = trigger_bad_patch(pkg)
|
||||
@ -304,8 +298,7 @@ def test_patch_failure_restages(mock_packages, install_mockery, mock_fetch):
|
||||
|
||||
def test_multiple_patched_dependencies(mock_packages, config):
|
||||
"""Test whether multiple patched dependencies work."""
|
||||
spec = Spec("patch-several-dependencies")
|
||||
spec.concretize()
|
||||
spec = spack.concretize.concretized(Spec("patch-several-dependencies"))
|
||||
|
||||
# basic patch on libelf
|
||||
assert "patches" in list(spec["libelf"].variants.keys())
|
||||
@ -320,8 +313,7 @@ def test_multiple_patched_dependencies(mock_packages, config):
|
||||
|
||||
def test_conditional_patched_dependencies(mock_packages, config):
|
||||
"""Test whether conditional patched dependencies work."""
|
||||
spec = Spec("patch-several-dependencies @1.0")
|
||||
spec.concretize()
|
||||
spec = spack.concretize.concretized(Spec("patch-several-dependencies @1.0"))
|
||||
|
||||
# basic patch on libelf
|
||||
assert "patches" in list(spec["libelf"].variants.keys())
|
||||
@ -397,8 +389,7 @@ def get_patch(spec, ending):
|
||||
|
||||
def test_conditional_patched_deps_with_conditions(mock_packages, config):
|
||||
"""Test whether conditional patched dependencies with conditions work."""
|
||||
spec = Spec("patch-several-dependencies @1.0 ^libdwarf@20111030")
|
||||
spec.concretize()
|
||||
spec = spack.concretize.concretized(Spec("patch-several-dependencies @1.0 ^libdwarf@20111030"))
|
||||
|
||||
libelf = spec["libelf"]
|
||||
libdwarf = spec["libdwarf"]
|
||||
@ -413,8 +404,7 @@ def test_write_and_read_sub_dags_with_patched_deps(mock_packages, config):
|
||||
"""Test whether patched dependencies are still correct after writing and
|
||||
reading a sub-DAG of a concretized Spec.
|
||||
"""
|
||||
spec = Spec("patch-several-dependencies @1.0 ^libdwarf@20111030")
|
||||
spec.concretize()
|
||||
spec = spack.concretize.concretized(Spec("patch-several-dependencies @1.0 ^libdwarf@20111030"))
|
||||
|
||||
# write to YAML and read back in -- new specs will *only* contain
|
||||
# their sub-DAGs, and won't contain the dependent that patched them
|
||||
@ -475,7 +465,7 @@ def test_equality():
|
||||
|
||||
def test_sha256_setter(mock_patch_stage, config):
|
||||
path = os.path.join(data_path, "foo.patch")
|
||||
s = Spec("patch").concretized()
|
||||
s = spack.concretize.concretized(Spec("patch"))
|
||||
patch = spack.patch.FilePatch(s.package, path, level=1, working_dir=".")
|
||||
patch.sha256 = "abc"
|
||||
|
||||
|
@ -9,6 +9,7 @@
|
||||
|
||||
import pytest
|
||||
|
||||
import spack.concretize
|
||||
import spack.deptypes as dt
|
||||
import spack.rewiring
|
||||
import spack.store
|
||||
@ -39,8 +40,8 @@ def check_spliced_spec_prefixes(spliced_spec):
|
||||
@pytest.mark.parametrize("transitive", [True, False])
|
||||
def test_rewire_db(mock_fetch, install_mockery, transitive):
|
||||
"""Tests basic rewiring without binary executables."""
|
||||
spec = Spec("splice-t^splice-h~foo").concretized()
|
||||
dep = Spec("splice-h+foo").concretized()
|
||||
spec = spack.concretize.concretized(Spec("splice-t^splice-h~foo"))
|
||||
dep = spack.concretize.concretized(Spec("splice-h+foo"))
|
||||
PackageInstaller([spec.package, dep.package], explicit=True).install()
|
||||
spliced_spec = spec.splice(dep, transitive=transitive)
|
||||
assert spec.dag_hash() != spliced_spec.dag_hash()
|
||||
@ -63,8 +64,8 @@ def test_rewire_db(mock_fetch, install_mockery, transitive):
|
||||
@pytest.mark.parametrize("transitive", [True, False])
|
||||
def test_rewire_bin(mock_fetch, install_mockery, transitive):
|
||||
"""Tests basic rewiring with binary executables."""
|
||||
spec = Spec("quux").concretized()
|
||||
dep = Spec("garply cflags=-g").concretized()
|
||||
spec = spack.concretize.concretized(Spec("quux"))
|
||||
dep = spack.concretize.concretized(Spec("garply cflags=-g"))
|
||||
PackageInstaller([spec.package, dep.package], explicit=True).install()
|
||||
spliced_spec = spec.splice(dep, transitive=transitive)
|
||||
|
||||
@ -92,8 +93,8 @@ def test_rewire_bin(mock_fetch, install_mockery, transitive):
|
||||
def test_rewire_writes_new_metadata(mock_fetch, install_mockery):
|
||||
"""Tests that new metadata was written during a rewire.
|
||||
Accuracy of metadata is left to other tests."""
|
||||
spec = Spec("quux").concretized()
|
||||
dep = Spec("garply cflags=-g").concretized()
|
||||
spec = spack.concretize.concretized(Spec("quux"))
|
||||
dep = spack.concretize.concretized(Spec("garply cflags=-g"))
|
||||
PackageInstaller([spec.package, dep.package], explicit=True).install()
|
||||
spliced_spec = spec.splice(dep, transitive=True)
|
||||
spack.rewiring.rewire(spliced_spec)
|
||||
@ -136,8 +137,8 @@ def test_rewire_writes_new_metadata(mock_fetch, install_mockery):
|
||||
@pytest.mark.parametrize("transitive", [True, False])
|
||||
def test_uninstall_rewired_spec(mock_fetch, install_mockery, transitive):
|
||||
"""Test that rewired packages can be uninstalled as normal."""
|
||||
spec = Spec("quux").concretized()
|
||||
dep = Spec("garply cflags=-g").concretized()
|
||||
spec = spack.concretize.concretized(Spec("quux"))
|
||||
dep = spack.concretize.concretized(Spec("garply cflags=-g"))
|
||||
PackageInstaller([spec.package, dep.package], explicit=True).install()
|
||||
spliced_spec = spec.splice(dep, transitive=transitive)
|
||||
spack.rewiring.rewire(spliced_spec)
|
||||
@ -150,8 +151,8 @@ def test_uninstall_rewired_spec(mock_fetch, install_mockery, transitive):
|
||||
def test_rewire_not_installed_fails(mock_fetch, install_mockery):
|
||||
"""Tests error when an attempt is made to rewire a package that was not
|
||||
previously installed."""
|
||||
spec = Spec("quux").concretized()
|
||||
dep = Spec("garply cflags=-g").concretized()
|
||||
spec = spack.concretize.concretized(Spec("quux"))
|
||||
dep = spack.concretize.concretized(Spec("garply cflags=-g"))
|
||||
spliced_spec = spec.splice(dep, False)
|
||||
with pytest.raises(
|
||||
spack.rewiring.PackageNotInstalledError,
|
||||
@ -165,8 +166,8 @@ def test_rewire_virtual(mock_fetch, install_mockery):
|
||||
dep = "splice-a"
|
||||
alt_dep = "splice-h"
|
||||
|
||||
spec = Spec(f"splice-vt^{dep}").concretized()
|
||||
alt_spec = Spec(alt_dep).concretized()
|
||||
spec = spack.concretize.concretized(Spec(f"splice-vt^{dep}"))
|
||||
alt_spec = spack.concretize.concretized(Spec(alt_dep))
|
||||
|
||||
PackageInstaller([spec.package, alt_spec.package]).install()
|
||||
|
||||
|
@ -7,6 +7,7 @@
|
||||
"""
|
||||
import pytest
|
||||
|
||||
import spack.concretize
|
||||
import spack.deptypes as dt
|
||||
import spack.error
|
||||
import spack.repo
|
||||
@ -75,7 +76,7 @@ def test_test_deptype(tmpdir):
|
||||
builder.add_package("w", dependencies=[("x", "test", None), ("y", None, None)])
|
||||
|
||||
with spack.repo.use_repositories(builder.root):
|
||||
spec = Spec("w").concretized(tests=("w",))
|
||||
spec = spack.concretize.concretized(Spec("w"), tests=("w",))
|
||||
assert "x" in spec
|
||||
assert "z" not in spec
|
||||
|
||||
@ -107,8 +108,7 @@ def test_installed_deps(monkeypatch, mock_packages):
|
||||
# BUT d is only a build dependency of C, so it won't constrain
|
||||
# link/run dependents of C when C is depended on as an existing
|
||||
# (concrete) installation.
|
||||
c_spec = Spec(c)
|
||||
c_spec.concretize()
|
||||
c_spec = spack.concretize.concretized(Spec(c))
|
||||
assert c_spec[d].version == spack.version.Version("2")
|
||||
|
||||
installed_names = [s.name for s in c_spec.traverse()]
|
||||
@ -123,7 +123,7 @@ def _mock_installed(self):
|
||||
# *if* we're doing a fresh installation.
|
||||
a_spec = Spec(a)
|
||||
a_spec._add_dependency(c_spec, depflag=dt.BUILD | dt.LINK, virtuals=())
|
||||
a_spec.concretize()
|
||||
a_spec = spack.concretize.concretized(a_spec)
|
||||
assert spack.version.Version("2") == a_spec[c][d].version
|
||||
assert spack.version.Version("2") == a_spec[e].version
|
||||
assert spack.version.Version("3") == a_spec[b][d].version
|
||||
@ -141,12 +141,12 @@ def test_specify_preinstalled_dep(tmpdir, monkeypatch):
|
||||
builder.add_package("pkg-a", dependencies=[("pkg-b", None, None)])
|
||||
|
||||
with spack.repo.use_repositories(builder.root):
|
||||
b_spec = Spec("pkg-b").concretized()
|
||||
b_spec = spack.concretize.concretized(Spec("pkg-b"))
|
||||
monkeypatch.setattr(Spec, "installed", property(lambda x: x.name != "pkg-a"))
|
||||
|
||||
a_spec = Spec("pkg-a")
|
||||
a_spec._add_dependency(b_spec, depflag=dt.BUILD | dt.LINK, virtuals=())
|
||||
a_spec.concretize()
|
||||
a_spec = spack.concretize.concretized(a_spec)
|
||||
|
||||
assert {x.name for x in a_spec.traverse()} == {"pkg-a", "pkg-b", "pkg-c"}
|
||||
|
||||
@ -168,7 +168,7 @@ def test_conditional_dep_with_user_constraints(tmpdir, spec_str, expr_str, expec
|
||||
builder.add_package("x", dependencies=[("y", None, "x@2:")])
|
||||
|
||||
with spack.repo.use_repositories(builder.root):
|
||||
spec = Spec(spec_str).concretized()
|
||||
spec = spack.concretize.concretized(Spec(spec_str))
|
||||
result = expr_str in spec
|
||||
assert result is expected, "{0} in {1}".format(expr_str, spec)
|
||||
|
||||
@ -182,10 +182,10 @@ def test_conflicting_package_constraints(self, set_dependency):
|
||||
spec = Spec("mpileaks ^mpich ^callpath ^dyninst ^libelf ^libdwarf")
|
||||
|
||||
with pytest.raises(spack.error.UnsatisfiableSpecError):
|
||||
spec.concretize()
|
||||
spack.concretize.concretized(spec)
|
||||
|
||||
def test_preorder_node_traversal(self):
|
||||
dag = Spec("mpileaks ^zmpi").concretized()
|
||||
dag = spack.concretize.concretized(Spec("mpileaks ^zmpi"))
|
||||
|
||||
names = ["mpileaks", "callpath", "dyninst", "libdwarf", "libelf", "zmpi", "fake"]
|
||||
pairs = list(zip([0, 1, 2, 3, 4, 2, 3], names))
|
||||
@ -197,7 +197,7 @@ def test_preorder_node_traversal(self):
|
||||
assert [(x, y.name) for x, y in traversal] == pairs
|
||||
|
||||
def test_preorder_edge_traversal(self):
|
||||
dag = Spec("mpileaks ^zmpi").concretized()
|
||||
dag = spack.concretize.concretized(Spec("mpileaks ^zmpi"))
|
||||
|
||||
names = [
|
||||
"mpileaks",
|
||||
@ -219,7 +219,7 @@ def test_preorder_edge_traversal(self):
|
||||
assert [(x, y.name) for x, y in traversal] == pairs
|
||||
|
||||
def test_preorder_path_traversal(self):
|
||||
dag = Spec("mpileaks ^zmpi").concretized()
|
||||
dag = spack.concretize.concretized(Spec("mpileaks ^zmpi"))
|
||||
|
||||
names = [
|
||||
"mpileaks",
|
||||
@ -242,7 +242,7 @@ def test_preorder_path_traversal(self):
|
||||
assert [(x, y.name) for x, y in traversal] == pairs
|
||||
|
||||
def test_postorder_node_traversal(self):
|
||||
dag = Spec("mpileaks ^zmpi").concretized()
|
||||
dag = spack.concretize.concretized(Spec("mpileaks ^zmpi"))
|
||||
|
||||
names = ["libelf", "libdwarf", "dyninst", "fake", "zmpi", "callpath", "mpileaks"]
|
||||
pairs = list(zip([4, 3, 2, 3, 2, 1, 0], names))
|
||||
@ -254,7 +254,7 @@ def test_postorder_node_traversal(self):
|
||||
assert [(x, y.name) for x, y in traversal] == pairs
|
||||
|
||||
def test_postorder_edge_traversal(self):
|
||||
dag = Spec("mpileaks ^zmpi").concretized()
|
||||
dag = spack.concretize.concretized(Spec("mpileaks ^zmpi"))
|
||||
|
||||
names = [
|
||||
"libelf",
|
||||
@ -276,7 +276,7 @@ def test_postorder_edge_traversal(self):
|
||||
assert [(x, y.name) for x, y in traversal] == pairs
|
||||
|
||||
def test_postorder_path_traversal(self):
|
||||
dag = Spec("mpileaks ^zmpi").concretized()
|
||||
dag = spack.concretize.concretized(Spec("mpileaks ^zmpi"))
|
||||
|
||||
names = [
|
||||
"libelf",
|
||||
@ -311,8 +311,8 @@ def test_dependents_and_dependencies_are_correct(self):
|
||||
}
|
||||
)
|
||||
check_links(spec)
|
||||
spec.concretize()
|
||||
check_links(spec)
|
||||
concrete = spack.concretize.concretized(spec)
|
||||
check_links(concrete)
|
||||
|
||||
@pytest.mark.parametrize(
|
||||
"constraint_str,spec_str",
|
||||
@ -329,7 +329,7 @@ def test_unsatisfiable_cases(self, set_dependency, constraint_str, spec_str):
|
||||
"""
|
||||
set_dependency("mpileaks", constraint_str)
|
||||
with pytest.raises(spack.error.UnsatisfiableSpecError):
|
||||
Spec(spec_str).concretize()
|
||||
spack.concretize.concretized(Spec(spec_str))
|
||||
|
||||
@pytest.mark.parametrize(
|
||||
"spec_str", ["libelf ^mpich", "libelf ^libdwarf", "mpich ^dyninst ^libelf"]
|
||||
@ -337,7 +337,7 @@ def test_unsatisfiable_cases(self, set_dependency, constraint_str, spec_str):
|
||||
def test_invalid_dep(self, spec_str):
|
||||
spec = Spec(spec_str)
|
||||
with pytest.raises(spack.error.SpecError):
|
||||
spec.concretize()
|
||||
spack.concretize.concretized(spec)
|
||||
|
||||
def test_equal(self):
|
||||
# Different spec structures to test for equality
|
||||
@ -400,8 +400,7 @@ def test_copy_simple(self):
|
||||
assert not orig_ids.intersection(copy_ids)
|
||||
|
||||
def test_copy_concretized(self):
|
||||
orig = Spec("mpileaks")
|
||||
orig.concretize()
|
||||
orig = spack.concretize.concretized(Spec("mpileaks"))
|
||||
copy = orig.copy()
|
||||
|
||||
check_links(copy)
|
||||
@ -420,7 +419,7 @@ def test_copy_through_spec_build_interface(self):
|
||||
"""Check that copying dependencies using id(node) as a fast identifier of the
|
||||
node works when the spec is wrapped in a SpecBuildInterface object.
|
||||
"""
|
||||
s = Spec("mpileaks").concretized()
|
||||
s = spack.concretize.concretized(Spec("mpileaks"))
|
||||
|
||||
c0 = s.copy()
|
||||
assert c0 == s
|
||||
@ -503,7 +502,7 @@ def test_copy_through_spec_build_interface(self):
|
||||
],
|
||||
)
|
||||
def test_deptype_traversal(self, spec_str, deptypes, expected):
|
||||
dag = Spec(spec_str).concretized()
|
||||
dag = spack.concretize.concretized(Spec(spec_str))
|
||||
traversal = dag.traverse(deptype=deptypes)
|
||||
assert [x.name for x in traversal] == expected
|
||||
|
||||
@ -635,20 +634,18 @@ def check_diamond_normalized_dag(self, spec):
|
||||
|
||||
def test_concretize_deptypes(self):
|
||||
"""Ensure that dependency types are preserved after concretization."""
|
||||
s = Spec("dt-diamond")
|
||||
s.concretize()
|
||||
s = spack.concretize.concretized(Spec("dt-diamond"))
|
||||
self.check_diamond_deptypes(s)
|
||||
|
||||
def test_copy_deptypes(self):
|
||||
"""Ensure that dependency types are preserved by spec copy."""
|
||||
s1 = Spec("dt-diamond").concretized()
|
||||
s1 = spack.concretize.concretized(Spec("dt-diamond"))
|
||||
self.check_diamond_deptypes(s1)
|
||||
s2 = s1.copy()
|
||||
self.check_diamond_deptypes(s2)
|
||||
|
||||
def test_getitem_query(self):
|
||||
s = Spec("mpileaks")
|
||||
s.concretize()
|
||||
s = spack.concretize.concretized(Spec("mpileaks"))
|
||||
|
||||
# Check a query to a non-virtual package
|
||||
a = s["callpath"]
|
||||
@ -678,8 +675,7 @@ def test_getitem_query(self):
|
||||
assert query.isvirtual
|
||||
|
||||
def test_getitem_exceptional_paths(self):
|
||||
s = Spec("mpileaks")
|
||||
s.concretize()
|
||||
s = spack.concretize.concretized(Spec("mpileaks"))
|
||||
# Needed to get a proxy object
|
||||
q = s["mpileaks"]
|
||||
|
||||
@ -750,7 +746,7 @@ def test_invalid_literal_spec(self):
|
||||
|
||||
def test_spec_tree_respect_deptypes(self):
|
||||
# Version-test-root uses version-test-pkg as a build dependency
|
||||
s = Spec("version-test-root").concretized()
|
||||
s = spack.concretize.concretized(Spec("version-test-root"))
|
||||
out = s.tree(deptypes="all")
|
||||
assert "version-test-pkg" in out
|
||||
out = s.tree(deptypes=("link", "run"))
|
||||
@ -834,9 +830,9 @@ def test_synthetic_construction_of_split_dependencies_from_same_package(mock_pac
|
||||
#
|
||||
# To demonstrate that a spec can now hold two direct
|
||||
# dependencies from the same package
|
||||
root = Spec("pkg-b").concretized()
|
||||
link_run_spec = Spec("pkg-c@=1.0").concretized()
|
||||
build_spec = Spec("pkg-c@=2.0").concretized()
|
||||
root = spack.concretize.concretized(Spec("pkg-b"))
|
||||
link_run_spec = spack.concretize.concretized(Spec("pkg-c@=1.0"))
|
||||
build_spec = spack.concretize.concretized(Spec("pkg-c@=2.0"))
|
||||
|
||||
root.add_dependency_edge(link_run_spec, depflag=dt.LINK, virtuals=())
|
||||
root.add_dependency_edge(link_run_spec, depflag=dt.RUN, virtuals=())
|
||||
@ -863,8 +859,8 @@ def test_synthetic_construction_bootstrapping(mock_packages, config):
|
||||
# | build
|
||||
# pkg-b@1.0
|
||||
#
|
||||
root = Spec("pkg-b@=2.0").concretized()
|
||||
bootstrap = Spec("pkg-b@=1.0").concretized()
|
||||
root = spack.concretize.concretized(Spec("pkg-b@=2.0"))
|
||||
bootstrap = spack.concretize.concretized(Spec("pkg-b@=1.0"))
|
||||
|
||||
root.add_dependency_edge(bootstrap, depflag=dt.BUILD, virtuals=())
|
||||
|
||||
@ -881,8 +877,8 @@ def test_addition_of_different_deptypes_in_multiple_calls(mock_packages, config)
|
||||
# pkg-b@1.0
|
||||
#
|
||||
# with three calls and check we always have a single edge
|
||||
root = Spec("pkg-b@=2.0").concretized()
|
||||
bootstrap = Spec("pkg-b@=1.0").concretized()
|
||||
root = spack.concretize.concretized(Spec("pkg-b@=2.0"))
|
||||
bootstrap = spack.concretize.concretized(Spec("pkg-b@=1.0"))
|
||||
|
||||
for current_depflag in (dt.BUILD, dt.LINK, dt.RUN):
|
||||
root.add_dependency_edge(bootstrap, depflag=current_depflag, virtuals=())
|
||||
@ -909,9 +905,9 @@ def test_addition_of_different_deptypes_in_multiple_calls(mock_packages, config)
|
||||
def test_adding_same_deptype_with_the_same_name_raises(
|
||||
mock_packages, config, c1_depflag, c2_depflag
|
||||
):
|
||||
p = Spec("pkg-b@=2.0").concretized()
|
||||
c1 = Spec("pkg-b@=1.0").concretized()
|
||||
c2 = Spec("pkg-b@=2.0").concretized()
|
||||
p = spack.concretize.concretized(Spec("pkg-b@=2.0"))
|
||||
c1 = spack.concretize.concretized(Spec("pkg-b@=1.0"))
|
||||
c2 = spack.concretize.concretized(Spec("pkg-b@=2.0"))
|
||||
|
||||
p.add_dependency_edge(c1, depflag=c1_depflag, virtuals=())
|
||||
with pytest.raises(spack.error.SpackError):
|
||||
|
@ -6,6 +6,7 @@
|
||||
|
||||
import pytest
|
||||
|
||||
import spack.concretize
|
||||
from spack.installer import PackageInstaller
|
||||
from spack.spec import Spec
|
||||
from spack.spec_list import SpecList
|
||||
@ -199,8 +200,8 @@ def test_spec_list_matrix_exclude(self, mock_packages):
|
||||
|
||||
def test_spec_list_exclude_with_abstract_hashes(self, mock_packages, install_mockery):
|
||||
# Put mpich in the database so it can be referred to by hash.
|
||||
mpich_1 = Spec("mpich+debug").concretized()
|
||||
mpich_2 = Spec("mpich~debug").concretized()
|
||||
mpich_1 = spack.concretize.concretized(Spec("mpich+debug"))
|
||||
mpich_2 = spack.concretize.concretized(Spec("mpich~debug"))
|
||||
PackageInstaller([mpich_1.package, mpich_2.package], explicit=True, fake=True).install()
|
||||
|
||||
# Create matrix and exclude +debug, which excludes the first mpich after its abstract hash
|
||||
|
@ -7,6 +7,7 @@
|
||||
|
||||
import pytest
|
||||
|
||||
import spack.concretize
|
||||
import spack.deptypes as dt
|
||||
import spack.directives
|
||||
import spack.error
|
||||
@ -590,8 +591,7 @@ def test_satisfies_single_valued_variant(self):
|
||||
https://github.com/spack/spack/pull/2386#issuecomment-282147639
|
||||
is handled correctly.
|
||||
"""
|
||||
a = Spec("pkg-a foobar=bar")
|
||||
a.concretize()
|
||||
a = spack.concretize.concretized(Spec("pkg-a foobar=bar"))
|
||||
|
||||
assert a.satisfies("foobar=bar")
|
||||
assert a.satisfies("foobar=*")
|
||||
@ -610,21 +610,18 @@ def test_satisfies_single_valued_variant(self):
|
||||
assert "^pkg-b" in a
|
||||
|
||||
def test_unsatisfied_single_valued_variant(self):
|
||||
a = Spec("pkg-a foobar=baz")
|
||||
a.concretize()
|
||||
a = spack.concretize.concretized(Spec("pkg-a foobar=baz"))
|
||||
assert "^pkg-b" not in a
|
||||
|
||||
mv = Spec("multivalue-variant")
|
||||
mv.concretize()
|
||||
mv = spack.concretize.concretized(Spec("multivalue-variant"))
|
||||
assert "pkg-a@1.0" not in mv
|
||||
|
||||
def test_indirect_unsatisfied_single_valued_variant(self):
|
||||
spec = Spec("singlevalue-variant-dependent")
|
||||
spec.concretize()
|
||||
spec = spack.concretize.concretized(Spec("singlevalue-variant-dependent"))
|
||||
assert "pkg-a@1.0" not in spec
|
||||
|
||||
def test_satisfied_namespace(self):
|
||||
spec = Spec("zlib").concretized()
|
||||
spec = spack.concretize.concretized(Spec("zlib"))
|
||||
assert spec.satisfies("namespace=builtin.mock")
|
||||
assert not spec.satisfies("namespace=builtin")
|
||||
|
||||
@ -684,7 +681,7 @@ def test_unsatisfiable_multi_value_variant(self, default_mock_concretization):
|
||||
# ...but will fail during concretization if there are
|
||||
# values in the variant that are not allowed
|
||||
with pytest.raises(InvalidVariantValueError):
|
||||
a.concretize()
|
||||
spack.concretize.concretized(a)
|
||||
|
||||
# This time we'll try to set a single-valued variant
|
||||
a = Spec('multivalue-variant fee="bar"')
|
||||
@ -701,11 +698,10 @@ def test_unsatisfiable_multi_value_variant(self, default_mock_concretization):
|
||||
# ...but will fail during concretization if there are
|
||||
# multiple values set
|
||||
with pytest.raises(MultipleValuesInExclusiveVariantError):
|
||||
a.concretize()
|
||||
spack.concretize.concretized(a)
|
||||
|
||||
def test_copy_satisfies_transitive(self):
|
||||
spec = Spec("dttop")
|
||||
spec.concretize()
|
||||
spec = spack.concretize.concretized(Spec("dttop"))
|
||||
copy = spec.copy()
|
||||
for s in spec.traverse():
|
||||
assert s.satisfies(copy[s.name])
|
||||
@ -728,7 +724,7 @@ def test_intersects_virtual_providers(self):
|
||||
|
||||
def test_intersectable_concrete_specs_must_have_the_same_hash(self):
|
||||
"""Ensure that concrete specs are matched *exactly* by hash."""
|
||||
s1 = Spec("mpileaks").concretized()
|
||||
s1 = spack.concretize.concretized(Spec("mpileaks"))
|
||||
s2 = s1.copy()
|
||||
|
||||
assert s1.satisfies(s2)
|
||||
@ -768,17 +764,10 @@ def test_dep_index(self, default_mock_concretization):
|
||||
|
||||
@pytest.mark.usefixtures("config")
|
||||
def test_virtual_index(self):
|
||||
s = Spec("callpath")
|
||||
s.concretize()
|
||||
|
||||
s_mpich = Spec("callpath ^mpich")
|
||||
s_mpich.concretize()
|
||||
|
||||
s_mpich2 = Spec("callpath ^mpich2")
|
||||
s_mpich2.concretize()
|
||||
|
||||
s_zmpi = Spec("callpath ^zmpi")
|
||||
s_zmpi.concretize()
|
||||
s = spack.concretize.concretized(Spec("callpath"))
|
||||
s_mpich = spack.concretize.concretized(Spec("callpath ^mpich"))
|
||||
s_mpich2 = spack.concretize.concretized(Spec("callpath ^mpich2"))
|
||||
s_zmpi = spack.concretize.concretized(Spec("callpath ^zmpi"))
|
||||
|
||||
assert s["mpi"].name != "mpi"
|
||||
assert s_mpich["mpi"].name == "mpich"
|
||||
@ -1048,7 +1037,7 @@ def test_abstract_spec_prefix_error(self):
|
||||
spec.prefix
|
||||
|
||||
def test_forwarding_of_architecture_attributes(self):
|
||||
spec = Spec("libelf target=x86_64").concretized()
|
||||
spec = spack.concretize.concretized(Spec("libelf target=x86_64"))
|
||||
|
||||
# Check that we can still access each member through
|
||||
# the architecture attribute
|
||||
@ -1373,7 +1362,7 @@ def test_target_constraints(self, spec, constraint, expected_result):
|
||||
def test_error_message_unknown_variant(self):
|
||||
s = Spec("mpileaks +unknown")
|
||||
with pytest.raises(UnknownVariantError):
|
||||
s.concretize()
|
||||
spack.concretize.concretized(s)
|
||||
|
||||
@pytest.mark.regression("18527")
|
||||
def test_satisfies_dependencies_ordered(self):
|
||||
@ -1400,8 +1389,7 @@ def test_splice_swap_names_mismatch_virtuals(self, default_mock_concretization,
|
||||
def test_spec_override(self):
|
||||
init_spec = Spec("pkg-a foo=baz foobar=baz cflags=-O3 cxxflags=-O1")
|
||||
change_spec = Spec("pkg-a foo=fee cflags=-O2")
|
||||
new_spec = Spec.override(init_spec, change_spec)
|
||||
new_spec.concretize()
|
||||
new_spec = spack.concretize.concretized(Spec.override(init_spec, change_spec))
|
||||
assert "foo=fee" in new_spec
|
||||
# This check fails without concretizing: apparently if both specs are
|
||||
# abstract, then the spec will always be considered to satisfy
|
||||
@ -1420,8 +1408,7 @@ def test_spec_override_with_nonexisting_variant(self):
|
||||
def test_spec_override_with_variant_not_in_init_spec(self):
|
||||
init_spec = Spec("pkg-a foo=baz foobar=baz cflags=-O3 cxxflags=-O1")
|
||||
change_spec = Spec("pkg-a +bvv ~lorem_ipsum")
|
||||
new_spec = Spec.override(init_spec, change_spec)
|
||||
new_spec.concretize()
|
||||
new_spec = spack.concretize.concretized(Spec.override(init_spec, change_spec))
|
||||
assert "+bvv" in new_spec
|
||||
assert "~lorem_ipsum" in new_spec
|
||||
|
||||
@ -1514,7 +1501,7 @@ def test_virtual_deps_bindings(self, default_mock_concretization, spec_str, spec
|
||||
)
|
||||
def test_unsatisfiable_virtual_deps_bindings(self, spec_str):
|
||||
with pytest.raises(spack.solver.asp.UnsatisfiableSpecError):
|
||||
Spec(spec_str).concretized()
|
||||
spack.concretize.concretized(Spec(spec_str))
|
||||
|
||||
|
||||
@pytest.mark.parametrize(
|
||||
@ -1612,7 +1599,7 @@ def test_spec_format_path_posix(spec_str, format_str, expected, mock_git_test_pa
|
||||
def test_is_extension_after_round_trip_to_dict(config, mock_packages, spec_str):
|
||||
# x is constructed directly from string, y from a
|
||||
# round-trip to dict representation
|
||||
x = Spec(spec_str).concretized()
|
||||
x = spack.concretize.concretized(Spec(spec_str))
|
||||
y = Spec.from_dict(x.to_dict())
|
||||
|
||||
# Using 'y' since the round-trip make us lose build dependencies
|
||||
@ -1713,7 +1700,7 @@ def test_call_dag_hash_on_old_dag_hash_spec(mock_packages, default_mock_concreti
|
||||
|
||||
|
||||
def test_spec_trim(mock_packages, config):
|
||||
top = Spec("dt-diamond").concretized()
|
||||
top = spack.concretize.concretized(Spec("dt-diamond"))
|
||||
top.trim("dt-diamond-left")
|
||||
remaining = set(x.name for x in top.traverse())
|
||||
assert set(["dt-diamond", "dt-diamond-right", "dt-diamond-bottom"]) == remaining
|
||||
@ -1726,7 +1713,7 @@ def test_spec_trim(mock_packages, config):
|
||||
@pytest.mark.regression("30861")
|
||||
def test_concretize_partial_old_dag_hash_spec(mock_packages, config):
|
||||
# create an "old" spec with no package hash
|
||||
bottom = Spec("dt-diamond-bottom").concretized()
|
||||
bottom = spack.concretize.concretized(Spec("dt-diamond-bottom"))
|
||||
delattr(bottom, "_package_hash")
|
||||
|
||||
dummy_hash = "zd4m26eis2wwbvtyfiliar27wkcv3ehk"
|
||||
@ -1737,7 +1724,7 @@ def test_concretize_partial_old_dag_hash_spec(mock_packages, config):
|
||||
top.add_dependency_edge(bottom, depflag=0, virtuals=())
|
||||
|
||||
# concretize with the already-concrete dependency
|
||||
top.concretize()
|
||||
top = spack.concretize.concretized(top)
|
||||
|
||||
for spec in top.traverse():
|
||||
assert spec.concrete
|
||||
@ -1955,7 +1942,7 @@ def test_edge_equality_does_not_depend_on_virtual_order():
|
||||
|
||||
|
||||
def test_old_format_strings_trigger_error(default_mock_concretization):
|
||||
s = Spec("pkg-a").concretized()
|
||||
s = spack.concretize.concretized(Spec("pkg-a"))
|
||||
with pytest.raises(SpecFormatStringError):
|
||||
s.format("${PACKAGE}-${VERSION}-${HASH}")
|
||||
|
||||
|
@ -11,6 +11,7 @@
|
||||
|
||||
import spack.binary_distribution
|
||||
import spack.cmd
|
||||
import spack.concretize
|
||||
import spack.parser
|
||||
import spack.platforms.test
|
||||
import spack.repo
|
||||
@ -774,7 +775,7 @@ def test_spec_by_hash_tokens(text, tokens):
|
||||
@pytest.mark.db
|
||||
def test_spec_by_hash(database, monkeypatch, config):
|
||||
mpileaks = database.query_one("mpileaks ^zmpi")
|
||||
b = spack.spec.Spec("pkg-b").concretized()
|
||||
b = spack.concretize.concretized(spack.spec.Spec("pkg-b"))
|
||||
monkeypatch.setattr(spack.binary_distribution, "update_cache_and_get_specs", lambda: [b])
|
||||
|
||||
hash_str = f"/{mpileaks.dag_hash()}"
|
||||
@ -871,7 +872,7 @@ def test_ambiguous_hash(mutable_database):
|
||||
In the past this ambiguity error would happen during parse time."""
|
||||
|
||||
# This is a very sketchy as manually setting hashes easily breaks invariants
|
||||
x1 = spack.spec.Spec("pkg-a").concretized()
|
||||
x1 = spack.concretize.concretized(spack.spec.Spec("pkg-a"))
|
||||
x2 = x1.copy()
|
||||
x1._hash = "xyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyy"
|
||||
x1._process_hash = "xyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyy"
|
||||
@ -945,8 +946,8 @@ def test_nonexistent_hash(database, config):
|
||||
],
|
||||
)
|
||||
def test_disambiguate_hash_by_spec(spec1, spec2, constraint, mock_packages, monkeypatch, config):
|
||||
spec1_concrete = spack.spec.Spec(spec1).concretized()
|
||||
spec2_concrete = spack.spec.Spec(spec2).concretized()
|
||||
spec1_concrete = spack.concretize.concretized(spack.spec.Spec(spec1))
|
||||
spec2_concrete = spack.concretize.concretized(spack.spec.Spec(spec2))
|
||||
|
||||
spec1_concrete._hash = "spec1"
|
||||
spec2_concrete._hash = "spec2"
|
||||
@ -1137,7 +1138,7 @@ def test_parse_filename_missing_slash_as_spec(specfile_for, tmpdir, filename):
|
||||
# Check that if we concretize this spec, we get a good error
|
||||
# message that mentions we might've meant a file.
|
||||
with pytest.raises(spack.repo.UnknownEntityError) as exc_info:
|
||||
spec.concretize()
|
||||
spack.concretize.concretized(spec)
|
||||
assert exc_info.value.long_message
|
||||
assert (
|
||||
"Did you mean to specify a filename with './libelf.yaml'?" in exc_info.value.long_message
|
||||
@ -1145,7 +1146,7 @@ def test_parse_filename_missing_slash_as_spec(specfile_for, tmpdir, filename):
|
||||
|
||||
# make sure that only happens when the spec ends in yaml
|
||||
with pytest.raises(spack.repo.UnknownPackageError) as exc_info:
|
||||
SpecParser("builtin.mock.doesnotexist").next_spec().concretize()
|
||||
spack.concretize.concretized(SpecParser("builtin.mock.doesnotexist").next_spec())
|
||||
assert not exc_info.value.long_message or (
|
||||
"Did you mean to specify a filename with" not in exc_info.value.long_message
|
||||
)
|
||||
|
@ -21,6 +21,7 @@
|
||||
import pytest
|
||||
import ruamel.yaml
|
||||
|
||||
import spack.concretize
|
||||
import spack.hash_types as ht
|
||||
import spack.paths
|
||||
import spack.repo
|
||||
@ -108,8 +109,7 @@ def test_roundtrip_concrete_specs(abstract_spec, default_mock_concretization):
|
||||
|
||||
|
||||
def test_yaml_subdag(config, mock_packages):
|
||||
spec = Spec("mpileaks^mpich+debug")
|
||||
spec.concretize()
|
||||
spec = spack.concretize.concretized(Spec("mpileaks^mpich+debug"))
|
||||
yaml_spec = Spec.from_yaml(spec.to_yaml())
|
||||
json_spec = Spec.from_json(spec.to_json())
|
||||
|
||||
@ -154,8 +154,7 @@ def test_ordered_read_not_required_for_consistent_dag_hash(config, mock_packages
|
||||
"""
|
||||
specs = ["mpileaks ^zmpi", "dttop", "dtuse"]
|
||||
for spec in specs:
|
||||
spec = Spec(spec)
|
||||
spec.concretize()
|
||||
spec = spack.concretize.concretized(Spec(spec))
|
||||
|
||||
#
|
||||
# Dict & corresponding YAML & JSON from the original spec.
|
||||
@ -215,11 +214,11 @@ def test_ordered_read_not_required_for_consistent_dag_hash(config, mock_packages
|
||||
assert spec.dag_hash() == round_trip_reversed_json_spec.dag_hash()
|
||||
|
||||
# dag_hash is equal after round-trip by dag_hash
|
||||
spec.concretize()
|
||||
round_trip_yaml_spec.concretize()
|
||||
round_trip_json_spec.concretize()
|
||||
round_trip_reversed_yaml_spec.concretize()
|
||||
round_trip_reversed_json_spec.concretize()
|
||||
spec = spack.concretize.concretized(spec)
|
||||
round_trip_yaml_spec = spack.concretize.concretized(round_trip_yaml_spec)
|
||||
round_trip_json_spec = spack.concretize.concretized(round_trip_json_spec)
|
||||
round_trip_reversed_yaml_spec = spack.concretize.concretized(round_trip_reversed_yaml_spec)
|
||||
round_trip_reversed_json_spec = spack.concretize.concretized(round_trip_reversed_json_spec)
|
||||
assert spec.dag_hash() == round_trip_yaml_spec.dag_hash()
|
||||
assert spec.dag_hash() == round_trip_json_spec.dag_hash()
|
||||
assert spec.dag_hash() == round_trip_reversed_yaml_spec.dag_hash()
|
||||
@ -323,7 +322,7 @@ def test_save_dependency_spec_jsons_subset(tmpdir, config):
|
||||
builder.add_package("pkg-a", dependencies=[("pkg-b", None, None), ("pkg-c", None, None)])
|
||||
|
||||
with spack.repo.use_repositories(builder.root):
|
||||
spec_a = Spec("pkg-a").concretized()
|
||||
spec_a = spack.concretize.concretized(Spec("pkg-a"))
|
||||
b_spec = spec_a["pkg-b"]
|
||||
c_spec = spec_a["pkg-c"]
|
||||
|
||||
@ -390,7 +389,7 @@ def test_legacy_yaml(tmpdir, install_mockery, mock_packages):
|
||||
build_hash: iaapywazxgetn6gfv2cfba353qzzqvhy
|
||||
"""
|
||||
spec = Spec.from_yaml(yaml)
|
||||
concrete_spec = spec.concretized()
|
||||
concrete_spec = spack.concretize.concretized(spec)
|
||||
assert concrete_spec.eq_dag(spec)
|
||||
|
||||
|
||||
|
@ -9,6 +9,7 @@
|
||||
|
||||
from llnl.util.filesystem import mkdirp, touch, working_dir
|
||||
|
||||
import spack.concretize
|
||||
import spack.config
|
||||
from spack.fetch_strategy import SvnFetchStrategy
|
||||
from spack.spec import Spec
|
||||
@ -41,7 +42,7 @@ def test_fetch(type_of_test, secure, mock_svn_repository, config, mutable_mock_r
|
||||
h = mock_svn_repository.hash
|
||||
|
||||
# Construct the package under test
|
||||
s = Spec("svn-test").concretized()
|
||||
s = spack.concretize.concretized(Spec("svn-test"))
|
||||
monkeypatch.setitem(s.package.versions, Version("svn"), t.args)
|
||||
|
||||
# Enter the stage directory and check some properties
|
||||
|
@ -10,6 +10,7 @@
|
||||
|
||||
from llnl.util.filesystem import join_path, mkdirp, touch
|
||||
|
||||
import spack.concretize
|
||||
import spack.config
|
||||
import spack.install_test
|
||||
import spack.spec
|
||||
@ -40,7 +41,7 @@ def ensure_results(filename, expected, present=True):
|
||||
|
||||
def test_test_log_name(mock_packages, config):
|
||||
"""Ensure test log path is reasonable."""
|
||||
spec = spack.spec.Spec("libdwarf").concretized()
|
||||
spec = spack.concretize.concretized(spack.spec.Spec("libdwarf"))
|
||||
|
||||
test_name = "test_name"
|
||||
|
||||
@ -53,7 +54,7 @@ def test_test_log_name(mock_packages, config):
|
||||
|
||||
def test_test_ensure_stage(mock_test_stage, mock_packages):
|
||||
"""Make sure test stage directory is properly set up."""
|
||||
spec = spack.spec.Spec("libdwarf").concretized()
|
||||
spec = spack.concretize.concretized(spack.spec.Spec("libdwarf"))
|
||||
|
||||
test_name = "test_name"
|
||||
|
||||
@ -66,7 +67,7 @@ def test_test_ensure_stage(mock_test_stage, mock_packages):
|
||||
|
||||
def test_write_test_result(mock_packages, mock_test_stage):
|
||||
"""Ensure test results written to a results file."""
|
||||
spec = spack.spec.Spec("libdwarf").concretized()
|
||||
spec = spack.concretize.concretized(spack.spec.Spec("libdwarf"))
|
||||
result = "TEST"
|
||||
test_name = "write-test"
|
||||
|
||||
@ -86,7 +87,7 @@ def test_write_test_result(mock_packages, mock_test_stage):
|
||||
|
||||
def test_test_not_installed(mock_packages, install_mockery, mock_test_stage):
|
||||
"""Attempt to perform stand-alone test for not_installed package."""
|
||||
spec = spack.spec.Spec("trivial-smoke-test").concretized()
|
||||
spec = spack.concretize.concretized(spack.spec.Spec("trivial-smoke-test"))
|
||||
test_suite = spack.install_test.TestSuite([spec])
|
||||
|
||||
test_suite()
|
||||
@ -103,7 +104,7 @@ def test_test_external(
|
||||
mock_packages, install_mockery, mock_test_stage, monkeypatch, arguments, status, msg
|
||||
):
|
||||
name = "trivial-smoke-test"
|
||||
spec = spack.spec.Spec(name).concretized()
|
||||
spec = spack.concretize.concretized(spack.spec.Spec(name))
|
||||
spec.external_path = "/path/to/external/{0}".format(name)
|
||||
|
||||
monkeypatch.setattr(spack.spec.Spec, "installed", _true)
|
||||
@ -124,7 +125,7 @@ def ensure_current_cache_fail(test_suite):
|
||||
with pytest.raises(spack.install_test.TestSuiteSpecError):
|
||||
_ = test_suite.current_test_data_dir
|
||||
|
||||
spec = spack.spec.Spec("libelf").concretized()
|
||||
spec = spack.concretize.concretized(spack.spec.Spec("libelf"))
|
||||
test_suite = spack.install_test.TestSuite([spec], "test-cache")
|
||||
|
||||
# Check no current specs yield failure
|
||||
@ -142,7 +143,7 @@ def ensure_current_cache_fail(test_suite):
|
||||
|
||||
|
||||
def test_test_spec_run_once(mock_packages, install_mockery, mock_test_stage):
|
||||
spec = spack.spec.Spec("libelf").concretized()
|
||||
spec = spack.concretize.concretized(spack.spec.Spec("libelf"))
|
||||
test_suite = spack.install_test.TestSuite([spec], "test-dups")
|
||||
(test_suite.specs[0]).package.test_suite = test_suite
|
||||
|
||||
@ -152,7 +153,7 @@ def test_test_spec_run_once(mock_packages, install_mockery, mock_test_stage):
|
||||
|
||||
@pytest.mark.not_on_windows("Cannot find echo executable")
|
||||
def test_test_spec_passes(mock_packages, install_mockery, mock_test_stage, monkeypatch):
|
||||
spec = spack.spec.Spec("simple-standalone-test").concretized()
|
||||
spec = spack.concretize.concretized(spack.spec.Spec("simple-standalone-test"))
|
||||
monkeypatch.setattr(spack.spec.Spec, "installed", _true)
|
||||
test_suite = spack.install_test.TestSuite([spec])
|
||||
test_suite()
|
||||
@ -178,7 +179,7 @@ def test_get_test_suite_too_many(mock_packages, mock_test_stage):
|
||||
name = "duplicate-alias"
|
||||
|
||||
def add_suite(package):
|
||||
spec = spack.spec.Spec(package).concretized()
|
||||
spec = spack.concretize.concretized(spack.spec.Spec(package))
|
||||
suite = spack.install_test.TestSuite([spec], name)
|
||||
suite.ensure_stage()
|
||||
spack.install_test.write_test_suite_file(suite)
|
||||
@ -200,7 +201,7 @@ def add_suite(package):
|
||||
)
|
||||
def test_test_function_names(mock_packages, install_mockery, virtuals, expected):
|
||||
"""Confirm test_function_names works as expected with/without virtuals."""
|
||||
spec = spack.spec.Spec("mpich").concretized()
|
||||
spec = spack.concretize.concretized(spack.spec.Spec("mpich"))
|
||||
tests = spack.install_test.test_function_names(spec.package, add_virtuals=virtuals)
|
||||
assert sorted(tests) == sorted(expected)
|
||||
|
||||
@ -213,7 +214,7 @@ def test_test_functions_fails():
|
||||
|
||||
def test_test_functions_pkgless(mock_packages, install_mockery, ensure_debug, capsys):
|
||||
"""Confirm works for package providing a package-less virtual."""
|
||||
spec = spack.spec.Spec("simple-standalone-test").concretized()
|
||||
spec = spack.concretize.concretized(spack.spec.Spec("simple-standalone-test"))
|
||||
fns = spack.install_test.test_functions(spec.package, add_virtuals=True)
|
||||
out = capsys.readouterr()
|
||||
assert len(fns) == 2, "Expected two test functions"
|
||||
@ -296,7 +297,7 @@ def test_process_test_parts(mock_packages):
|
||||
|
||||
def test_test_part_fail(tmpdir, install_mockery, mock_fetch, mock_test_stage):
|
||||
"""Confirm test_part with a ProcessError results in FAILED status."""
|
||||
s = spack.spec.Spec("trivial-smoke-test").concretized()
|
||||
s = spack.concretize.concretized(spack.spec.Spec("trivial-smoke-test"))
|
||||
pkg = s.package
|
||||
pkg.tester.test_log_file = str(tmpdir.join("test-log.txt"))
|
||||
touch(pkg.tester.test_log_file)
|
||||
@ -312,7 +313,7 @@ def test_test_part_fail(tmpdir, install_mockery, mock_fetch, mock_test_stage):
|
||||
|
||||
def test_test_part_pass(install_mockery, mock_fetch, mock_test_stage):
|
||||
"""Confirm test_part that succeeds results in PASSED status."""
|
||||
s = spack.spec.Spec("trivial-smoke-test").concretized()
|
||||
s = spack.concretize.concretized(spack.spec.Spec("trivial-smoke-test"))
|
||||
pkg = s.package
|
||||
|
||||
name = "test_echo"
|
||||
@ -331,7 +332,7 @@ def test_test_part_pass(install_mockery, mock_fetch, mock_test_stage):
|
||||
|
||||
def test_test_part_skip(install_mockery, mock_fetch, mock_test_stage):
|
||||
"""Confirm test_part that raises SkipTest results in test status SKIPPED."""
|
||||
s = spack.spec.Spec("trivial-smoke-test").concretized()
|
||||
s = spack.concretize.concretized(spack.spec.Spec("trivial-smoke-test"))
|
||||
pkg = s.package
|
||||
|
||||
name = "test_skip"
|
||||
@ -345,7 +346,7 @@ def test_test_part_skip(install_mockery, mock_fetch, mock_test_stage):
|
||||
|
||||
def test_test_part_missing_exe_fail_fast(tmpdir, install_mockery, mock_fetch, mock_test_stage):
|
||||
"""Confirm test_part with fail fast enabled raises exception."""
|
||||
s = spack.spec.Spec("trivial-smoke-test").concretized()
|
||||
s = spack.concretize.concretized(spack.spec.Spec("trivial-smoke-test"))
|
||||
pkg = s.package
|
||||
pkg.tester.test_log_file = str(tmpdir.join("test-log.txt"))
|
||||
touch(pkg.tester.test_log_file)
|
||||
@ -366,7 +367,7 @@ def test_test_part_missing_exe_fail_fast(tmpdir, install_mockery, mock_fetch, mo
|
||||
|
||||
def test_test_part_missing_exe(tmpdir, install_mockery, mock_fetch, mock_test_stage):
|
||||
"""Confirm test_part with missing executable fails."""
|
||||
s = spack.spec.Spec("trivial-smoke-test").concretized()
|
||||
s = spack.concretize.concretized(spack.spec.Spec("trivial-smoke-test"))
|
||||
pkg = s.package
|
||||
pkg.tester.test_log_file = str(tmpdir.join("test-log.txt"))
|
||||
touch(pkg.tester.test_log_file)
|
||||
@ -402,7 +403,7 @@ def test_embedded_test_part_status(
|
||||
):
|
||||
"""Check to ensure the status of the enclosing test part reflects summary of embedded parts."""
|
||||
|
||||
s = spack.spec.Spec("trivial-smoke-test").concretized()
|
||||
s = spack.concretize.concretized(spack.spec.Spec("trivial-smoke-test"))
|
||||
pkg = s.package
|
||||
base_name = "test_example"
|
||||
part_name = f"{pkg.__class__.__name__}::{base_name}"
|
||||
@ -429,7 +430,7 @@ def test_write_tested_status(
|
||||
tmpdir, install_mockery, mock_fetch, mock_test_stage, statuses, expected
|
||||
):
|
||||
"""Check to ensure the status of the enclosing test part reflects summary of embedded parts."""
|
||||
s = spack.spec.Spec("trivial-smoke-test").concretized()
|
||||
s = spack.concretize.concretized(spack.spec.Spec("trivial-smoke-test"))
|
||||
pkg = s.package
|
||||
for i, status in enumerate(statuses):
|
||||
pkg.tester.test_parts[f"test_{i}"] = status
|
||||
@ -445,7 +446,7 @@ def test_write_tested_status(
|
||||
@pytest.mark.regression("37840")
|
||||
def test_write_tested_status_no_repeats(tmpdir, install_mockery, mock_fetch, mock_test_stage):
|
||||
"""Emulate re-running the same stand-alone tests a second time."""
|
||||
s = spack.spec.Spec("trivial-smoke-test").concretized()
|
||||
s = spack.concretize.concretized(spack.spec.Spec("trivial-smoke-test"))
|
||||
pkg = s.package
|
||||
statuses = [TestStatus.PASSED, TestStatus.PASSED]
|
||||
for i, status in enumerate(statuses):
|
||||
|
@ -14,6 +14,7 @@
|
||||
import llnl.util.tty as tty
|
||||
from llnl.util.filesystem import is_exe, working_dir
|
||||
|
||||
import spack.concretize
|
||||
import spack.config
|
||||
import spack.error
|
||||
import spack.fetch_strategy as fs
|
||||
@ -193,7 +194,7 @@ def test_from_list_url(mock_packages, config, spec, url, digest, _fetch_method):
|
||||
have checksums in the package.
|
||||
"""
|
||||
with spack.config.override("config:url_fetch_method", _fetch_method):
|
||||
s = Spec(spec).concretized()
|
||||
s = spack.concretize.concretized(Spec(spec))
|
||||
fetch_strategy = fs.from_list_url(s.package)
|
||||
assert isinstance(fetch_strategy, fs.URLFetchStrategy)
|
||||
assert os.path.basename(fetch_strategy.url) == url
|
||||
@ -219,7 +220,7 @@ def test_new_version_from_list_url(
|
||||
):
|
||||
"""Test non-specific URLs from the url-list-test package."""
|
||||
with spack.config.override("config:url_fetch_method", _fetch_method):
|
||||
s = Spec(f"url-list-test @{requested_version}").concretized()
|
||||
s = spack.concretize.concretized(Spec(f"url-list-test @{requested_version}"))
|
||||
fetch_strategy = fs.from_list_url(s.package)
|
||||
|
||||
assert isinstance(fetch_strategy, fs.URLFetchStrategy)
|
||||
@ -233,7 +234,7 @@ def test_new_version_from_list_url(
|
||||
|
||||
def test_nosource_from_list_url(mock_packages, config):
|
||||
"""This test confirms BundlePackages do not have list url."""
|
||||
s = Spec("nosource").concretized()
|
||||
s = spack.concretize.concretized(Spec("nosource"))
|
||||
fetch_strategy = fs.from_list_url(s.package)
|
||||
assert fetch_strategy is None
|
||||
|
||||
|
@ -8,6 +8,7 @@
|
||||
|
||||
import pytest
|
||||
|
||||
import spack.concretize
|
||||
import spack.directives
|
||||
import spack.directives_meta
|
||||
import spack.paths
|
||||
@ -92,8 +93,8 @@ def test_all_same_but_install(mock_packages, config):
|
||||
|
||||
|
||||
def test_content_hash_all_same_but_patch_contents(mock_packages, config):
|
||||
spec1 = Spec("hash-test1@1.1").concretized()
|
||||
spec2 = Spec("hash-test2@1.1").concretized()
|
||||
spec1 = spack.concretize.concretized(Spec("hash-test1@1.1"))
|
||||
spec2 = spack.concretize.concretized(Spec("hash-test2@1.1"))
|
||||
compare_hash_sans_name(False, spec1, spec2)
|
||||
|
||||
|
||||
@ -118,8 +119,8 @@ def test_content_hash_not_concretized(mock_packages, config):
|
||||
|
||||
|
||||
def test_content_hash_different_variants(mock_packages, config):
|
||||
spec1 = Spec("hash-test1@1.2 +variantx").concretized()
|
||||
spec2 = Spec("hash-test2@1.2 ~variantx").concretized()
|
||||
spec1 = spack.concretize.concretized(Spec("hash-test1@1.2 +variantx"))
|
||||
spec2 = spack.concretize.concretized(Spec("hash-test2@1.2 ~variantx"))
|
||||
compare_hash_sans_name(True, spec1, spec2)
|
||||
|
||||
|
||||
@ -133,19 +134,19 @@ def test_content_hash_cannot_get_details_from_ast(mock_packages, config):
|
||||
differ where Spack includes a phase on account of AST-examination
|
||||
failure.
|
||||
"""
|
||||
spec3 = Spec("hash-test1@1.7").concretized()
|
||||
spec4 = Spec("hash-test3@1.7").concretized()
|
||||
spec3 = spack.concretize.concretized(Spec("hash-test1@1.7"))
|
||||
spec4 = spack.concretize.concretized(Spec("hash-test3@1.7"))
|
||||
compare_hash_sans_name(False, spec3, spec4)
|
||||
|
||||
|
||||
def test_content_hash_all_same_but_archive_hash(mock_packages, config):
|
||||
spec1 = Spec("hash-test1@1.3").concretized()
|
||||
spec2 = Spec("hash-test2@1.3").concretized()
|
||||
spec1 = spack.concretize.concretized(Spec("hash-test1@1.3"))
|
||||
spec2 = spack.concretize.concretized(Spec("hash-test2@1.3"))
|
||||
compare_hash_sans_name(False, spec1, spec2)
|
||||
|
||||
|
||||
def test_content_hash_parse_dynamic_function_call(mock_packages, config):
|
||||
spec = Spec("hash-test4").concretized()
|
||||
spec = spack.concretize.concretized(Spec("hash-test4"))
|
||||
spec.package.content_hash()
|
||||
|
||||
|
||||
|
@ -6,6 +6,7 @@
|
||||
|
||||
import pytest
|
||||
|
||||
import spack.concretize
|
||||
import spack.error
|
||||
import spack.repo
|
||||
import spack.spec
|
||||
@ -691,7 +692,7 @@ def test_concrete(self, mock_packages, config) -> None:
|
||||
assert not vm.concrete
|
||||
|
||||
# concrete if associated spec is concrete
|
||||
spec.concretize()
|
||||
spec = spack.concretize.concretized(spec)
|
||||
assert vm.concrete
|
||||
|
||||
# concrete if all variants are present (even if spec not concrete)
|
||||
@ -911,7 +912,7 @@ def test_concretize_variant_default_with_multiple_defs(
|
||||
pkg = spack.repo.PATH.get_pkg_class(pkg_name)
|
||||
pkg_defs = [vdef for _, vdef in pkg.variant_definitions("v")]
|
||||
|
||||
spec = spack.spec.Spec(f"{pkg_name}{spec}").concretized()
|
||||
spec = spack.concretize.concretized(spack.spec.Spec(f"{pkg_name}{spec}"))
|
||||
assert spec.satisfies(satisfies)
|
||||
assert spec.package.get_variant("v") is pkg_defs[def_id]
|
||||
|
||||
|
@ -14,6 +14,7 @@
|
||||
|
||||
from llnl.util.filesystem import working_dir
|
||||
|
||||
import spack.concretize
|
||||
import spack.package_base
|
||||
import spack.spec
|
||||
import spack.version
|
||||
@ -708,7 +709,7 @@ def test_git_hash_comparisons(
|
||||
spack.package_base.PackageBase, "git", pathlib.Path(repo_path).as_uri(), raising=False
|
||||
)
|
||||
|
||||
spec = spack.spec.Spec(f"git-test-commit@{commits[commit_idx]}").concretized()
|
||||
spec = spack.concretize.concretized(spack.spec.Spec(f"git-test-commit@{commits[commit_idx]}"))
|
||||
for item in expected_satisfies:
|
||||
assert spec.satisfies(item)
|
||||
|
||||
@ -724,15 +725,13 @@ def test_git_ref_comparisons(mock_git_version_info, install_mockery, mock_packag
|
||||
)
|
||||
|
||||
# Spec based on tag v1.0
|
||||
spec_tag = spack.spec.Spec("git-test-commit@git.v1.0")
|
||||
spec_tag.concretize()
|
||||
spec_tag = spack.concretize.concretized(spack.spec.Spec("git-test-commit@git.v1.0"))
|
||||
assert spec_tag.satisfies("@1.0")
|
||||
assert not spec_tag.satisfies("@1.1:")
|
||||
assert str(spec_tag.version) == "git.v1.0=1.0"
|
||||
|
||||
# Spec based on branch 1.x
|
||||
spec_branch = spack.spec.Spec("git-test-commit@git.1.x")
|
||||
spec_branch.concretize()
|
||||
spec_branch = spack.concretize.concretized(spack.spec.Spec("git-test-commit@git.1.x"))
|
||||
assert spec_branch.satisfies("@1.2")
|
||||
assert spec_branch.satisfies("@1.1:1.3")
|
||||
assert str(spec_branch.version) == "git.1.x=1.2"
|
||||
@ -1031,7 +1030,7 @@ def test_git_version_repo_attached_after_serialization(
|
||||
monkeypatch.setattr(
|
||||
spack.package_base.PackageBase, "git", "file://%s" % repo_path, raising=False
|
||||
)
|
||||
spec = spack.spec.Spec(f"git-test-commit@{commits[-2]}").concretized()
|
||||
spec = spack.concretize.concretized(spack.spec.Spec(f"git-test-commit@{commits[-2]}"))
|
||||
|
||||
# Before serialization, the repo is attached
|
||||
assert spec.satisfies("@1.0")
|
||||
@ -1051,7 +1050,7 @@ def test_resolved_git_version_is_shown_in_str(
|
||||
spack.package_base.PackageBase, "git", "file://%s" % repo_path, raising=False
|
||||
)
|
||||
commit = commits[-3]
|
||||
spec = spack.spec.Spec(f"git-test-commit@{commit}").concretized()
|
||||
spec = spack.concretize.concretized(spack.spec.Spec(f"git-test-commit@{commit}"))
|
||||
|
||||
assert spec.version.satisfies(ver("1.0"))
|
||||
assert str(spec.version) == f"{commit}=1.0-git.1"
|
||||
|
@ -7,6 +7,7 @@
|
||||
|
||||
import pytest
|
||||
|
||||
import spack.concretize
|
||||
from spack.directory_layout import DirectoryLayout
|
||||
from spack.filesystem_view import SimpleFilesystemView, YamlFilesystemView
|
||||
from spack.installer import PackageInstaller
|
||||
@ -17,7 +18,7 @@ def test_remove_extensions_ordered(install_mockery, mock_fetch, tmpdir):
|
||||
view_dir = str(tmpdir.join("view"))
|
||||
layout = DirectoryLayout(view_dir)
|
||||
view = YamlFilesystemView(view_dir, layout)
|
||||
e2 = Spec("extension2").concretized()
|
||||
e2 = spack.concretize.concretized(Spec("extension2"))
|
||||
PackageInstaller([e2.package], explicit=True).install()
|
||||
view.add_specs(e2)
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user