directives: remove workaround for the c, cxx and fortran language

Signed-off-by: Massimiliano Culpo <massimiliano.culpo@gmail.com>
This commit is contained in:
Massimiliano Culpo 2024-09-02 11:15:02 +02:00
parent 285926cb69
commit a10f3295bc
No known key found for this signature in database
GPG Key ID: 3E52BB992233066C

View File

@ -85,9 +85,6 @@ class OpenMpi(Package):
PatchesType = Union[Patcher, str, List[Union[Patcher, str]]] PatchesType = Union[Patcher, str, List[Union[Patcher, str]]]
SUPPORTED_LANGUAGES = ("fortran", "cxx", "c")
def _make_when_spec(value: WhenType) -> Optional[spack.spec.Spec]: def _make_when_spec(value: WhenType) -> Optional[spack.spec.Spec]:
"""Create a ``Spec`` that indicates when a directive should be applied. """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, {}) deps_by_name = pkg.dependencies.setdefault(when_spec, {})
dependency = deps_by_name.get(spec.name) 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( raise DirectiveError(
f"the '^' sigil cannot be used in 'depends_on' directives. Please reformulate " f"the '^' sigil cannot be used in 'depends_on' directives. Please reformulate "
f"the directive below as multiple directives:\n\n" f"the directive below as multiple directives:\n\n"
@ -373,9 +371,6 @@ def depends_on(
""" """
dep_spec = spack.spec.Spec(spec) 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]): def _execute_depends_on(pkg: Type[spack.package_base.PackageBase]):
_depends_on(pkg, dep_spec, when=when, type=type, patches=patches) _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 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): class DependencyError(DirectiveError):
"""This is raised when a dependency specification is invalid.""" """This is raised when a dependency specification is invalid."""