diff options
author | Massimiliano Culpo <massimiliano.culpo@gmail.com> | 2024-08-14 11:47:36 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-08-14 11:47:36 +0200 |
commit | 97ffe2e5750711d7b713e8a7263720b1fb90de9f (patch) | |
tree | 3a569e81b2088d161e1a68fc9efcf843234bd891 /lib | |
parent | 7b10aae3560c6b9f0277b498be79dbe536e708c4 (diff) | |
download | spack-97ffe2e5750711d7b713e8a7263720b1fb90de9f.tar.gz spack-97ffe2e5750711d7b713e8a7263720b1fb90de9f.tar.bz2 spack-97ffe2e5750711d7b713e8a7263720b1fb90de9f.tar.xz spack-97ffe2e5750711d7b713e8a7263720b1fb90de9f.zip |
Add schema for compiler options in packages.yaml (#45738)
Diffstat (limited to 'lib')
-rw-r--r-- | lib/spack/spack/schema/compilers.py | 46 | ||||
-rw-r--r-- | lib/spack/spack/schema/packages.py | 13 |
2 files changed, 35 insertions, 24 deletions
diff --git a/lib/spack/spack/schema/compilers.py b/lib/spack/spack/schema/compilers.py index 1df696cda9..976a9777fc 100644 --- a/lib/spack/spack/schema/compilers.py +++ b/lib/spack/spack/schema/compilers.py @@ -11,6 +11,26 @@ from typing import Any, Dict import spack.schema.environment +flags: Dict[str, Any] = { + "type": "object", + "additionalProperties": False, + "properties": { + "cflags": {"anyOf": [{"type": "string"}, {"type": "null"}]}, + "cxxflags": {"anyOf": [{"type": "string"}, {"type": "null"}]}, + "fflags": {"anyOf": [{"type": "string"}, {"type": "null"}]}, + "cppflags": {"anyOf": [{"type": "string"}, {"type": "null"}]}, + "ldflags": {"anyOf": [{"type": "string"}, {"type": "null"}]}, + "ldlibs": {"anyOf": [{"type": "string"}, {"type": "null"}]}, + }, +} + + +extra_rpaths: Dict[str, Any] = {"type": "array", "default": [], "items": {"type": "string"}} + +implicit_rpaths: Dict[str, Any] = { + "anyOf": [{"type": "array", "items": {"type": "string"}}, {"type": "boolean"}] +} + #: Properties for inclusion in other schemas properties: Dict[str, Any] = { "compilers": { @@ -35,18 +55,7 @@ properties: Dict[str, Any] = { "fc": {"anyOf": [{"type": "string"}, {"type": "null"}]}, }, }, - "flags": { - "type": "object", - "additionalProperties": False, - "properties": { - "cflags": {"anyOf": [{"type": "string"}, {"type": "null"}]}, - "cxxflags": {"anyOf": [{"type": "string"}, {"type": "null"}]}, - "fflags": {"anyOf": [{"type": "string"}, {"type": "null"}]}, - "cppflags": {"anyOf": [{"type": "string"}, {"type": "null"}]}, - "ldflags": {"anyOf": [{"type": "string"}, {"type": "null"}]}, - "ldlibs": {"anyOf": [{"type": "string"}, {"type": "null"}]}, - }, - }, + "flags": flags, "spec": {"type": "string"}, "operating_system": {"type": "string"}, "target": {"type": "string"}, @@ -54,18 +63,9 @@ properties: Dict[str, Any] = { "modules": { "anyOf": [{"type": "string"}, {"type": "null"}, {"type": "array"}] }, - "implicit_rpaths": { - "anyOf": [ - {"type": "array", "items": {"type": "string"}}, - {"type": "boolean"}, - ] - }, + "implicit_rpaths": implicit_rpaths, "environment": spack.schema.environment.definition, - "extra_rpaths": { - "type": "array", - "default": [], - "items": {"type": "string"}, - }, + "extra_rpaths": extra_rpaths, }, } }, diff --git a/lib/spack/spack/schema/packages.py b/lib/spack/spack/schema/packages.py index 847b15d913..0acf8411fa 100644 --- a/lib/spack/spack/schema/packages.py +++ b/lib/spack/spack/schema/packages.py @@ -11,6 +11,8 @@ from typing import Any, Dict import spack.schema.environment +from .compilers import extra_rpaths, flags, implicit_rpaths + permissions = { "type": "object", "additionalProperties": False, @@ -184,7 +186,16 @@ properties: Dict[str, Any] = { "type": "object", "additionalProperties": True, "properties": { - "environment": spack.schema.environment.definition + "compilers": { + "type": "object", + "patternProperties": { + r"(^\w[\w-]*)": {"type": "string"} + }, + }, + "environment": spack.schema.environment.definition, + "extra_rpaths": extra_rpaths, + "implicit_rpaths": implicit_rpaths, + "flags": flags, }, }, }, |