diff options
author | Massimiliano Culpo <massimiliano.culpo@gmail.com> | 2024-02-23 10:48:07 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-02-23 10:48:07 +0100 |
commit | 0979a6a875d7140bc963b308f5d2a87bca94cc02 (patch) | |
tree | 7ae7876123e460bcb8e0879a8f9da289cb697321 | |
parent | 98de8e325708da62c0d17b4607e62c9c7b7ab9e2 (diff) | |
download | spack-0979a6a875d7140bc963b308f5d2a87bca94cc02.tar.gz spack-0979a6a875d7140bc963b308f5d2a87bca94cc02.tar.bz2 spack-0979a6a875d7140bc963b308f5d2a87bca94cc02.tar.xz spack-0979a6a875d7140bc963b308f5d2a87bca94cc02.zip |
Remove dead code from Environment (#42818)
Environment.concretize_and_add is not used anywhere.
-rw-r--r-- | lib/spack/spack/environment/environment.py | 38 | ||||
-rw-r--r-- | lib/spack/spack/test/cmd/env.py | 9 |
2 files changed, 0 insertions, 47 deletions
diff --git a/lib/spack/spack/environment/environment.py b/lib/spack/spack/environment/environment.py index 2433e59b21..2ffa760ccd 100644 --- a/lib/spack/spack/environment/environment.py +++ b/lib/spack/spack/environment/environment.py @@ -1485,44 +1485,6 @@ class Environment: ] return results - def concretize_and_add(self, user_spec, concrete_spec=None, tests=False): - """Concretize and add a single spec to the environment. - - Concretize the provided ``user_spec`` and add it along with the - concretized result to the environment. If the given ``user_spec`` was - already present in the environment, this does not add a duplicate. - The concretized spec will be added unless the ``user_spec`` was - already present and an associated concrete spec was already present. - - Args: - concrete_spec: if provided, then it is assumed that it is the - result of concretizing the provided ``user_spec`` - """ - if self.unify is True: - msg = ( - "cannot install a single spec in an environment that is " - "configured to be concretized together. Run instead:\n\n" - " $ spack add <spec>\n" - " $ spack install\n" - ) - raise SpackEnvironmentError(msg) - - spec = Spec(user_spec) - - if self.add(spec): - concrete = concrete_spec or spec.concretized(tests=tests) - self._add_concrete_spec(spec, concrete) - else: - # spec might be in the user_specs, but not installed. - # TODO: Redo name-based comparison for old style envs - spec = next(s for s in self.user_specs if s.satisfies(user_spec)) - concrete = self.specs_by_hash.get(spec.dag_hash()) - if not concrete: - concrete = spec.concretized(tests=tests) - self._add_concrete_spec(spec, concrete) - - return concrete - @property def default_view(self): if not self.has_view(default_view_name): diff --git a/lib/spack/spack/test/cmd/env.py b/lib/spack/spack/test/cmd/env.py index e22502f5d0..bec5663e27 100644 --- a/lib/spack/spack/test/cmd/env.py +++ b/lib/spack/spack/test/cmd/env.py @@ -2731,15 +2731,6 @@ def test_concretize_user_specs_together(): assert all("mpich" not in spec for _, spec in e.concretized_specs()) -def test_cant_install_single_spec_when_concretizing_together(): - e = ev.create("coconcretization") - e.unify = True - - with pytest.raises(ev.SpackEnvironmentError, match=r"cannot install"): - e.concretize_and_add("zlib") - e.install_all() - - def test_duplicate_packages_raise_when_concretizing_together(): e = ev.create("coconcretization") e.unify = True |