From a10f3295bcac3cc4f322798280e1810ff2694f86 Mon Sep 17 00:00:00 2001 From: Massimiliano Culpo Date: Mon, 2 Sep 2024 11:15:02 +0200 Subject: [PATCH] directives: remove workaround for the c, cxx and fortran language Signed-off-by: Massimiliano Culpo --- lib/spack/spack/directives.py | 24 ++---------------------- 1 file changed, 2 insertions(+), 22 deletions(-) diff --git a/lib/spack/spack/directives.py b/lib/spack/spack/directives.py index bac466ed213..4c3b665edc9 100644 --- a/lib/spack/spack/directives.py +++ b/lib/spack/spack/directives.py @@ -85,9 +85,6 @@ class OpenMpi(Package): PatchesType = Union[Patcher, str, List[Union[Patcher, str]]] -SUPPORTED_LANGUAGES = ("fortran", "cxx", "c") - - def _make_when_spec(value: WhenType) -> Optional[spack.spec.Spec]: """Create a ``Spec`` that indicates when a directive should be applied. @@ -296,7 +293,8 @@ def _depends_on( deps_by_name = pkg.dependencies.setdefault(when_spec, {}) dependency = deps_by_name.get(spec.name) - if spec.dependencies(): + edges = spec.edges_to_dependencies() + if edges and not all(x.depflag == dt.BUILD for x in edges): raise DirectiveError( f"the '^' sigil cannot be used in 'depends_on' directives. Please reformulate " f"the directive below as multiple directives:\n\n" @@ -373,9 +371,6 @@ def depends_on( """ dep_spec = spack.spec.Spec(spec) - if dep_spec.name in SUPPORTED_LANGUAGES: - assert type == "build", "languages must be of 'build' type" - return _language(lang_spec_str=spec, when=when) def _execute_depends_on(pkg: Type[spack.package_base.PackageBase]): _depends_on(pkg, dep_spec, when=when, type=type, patches=patches) @@ -911,21 +906,6 @@ def _execute_requires(pkg: Type[spack.package_base.PackageBase]): return _execute_requires -@directive("languages") -def _language(lang_spec_str: str, *, when: Optional[Union[str, bool]] = None): - """Temporary implementation of language virtuals, until compilers are proper dependencies.""" - - def _execute_languages(pkg: Type[spack.package_base.PackageBase]): - when_spec = _make_when_spec(when) - if not when_spec: - return - - languages = pkg.languages.setdefault(when_spec, set()) - languages.add(lang_spec_str) - - return _execute_languages - - class DependencyError(DirectiveError): """This is raised when a dependency specification is invalid."""