Add schema for compiler options in packages.yaml (#45738)

This commit is contained in:
Massimiliano Culpo 2024-08-14 11:47:36 +02:00 committed by GitHub
parent 7b10aae356
commit 97ffe2e575
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 35 additions and 24 deletions

View File

@ -11,6 +11,26 @@
import spack.schema.environment 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 for inclusion in other schemas
properties: Dict[str, Any] = { properties: Dict[str, Any] = {
"compilers": { "compilers": {
@ -35,18 +55,7 @@
"fc": {"anyOf": [{"type": "string"}, {"type": "null"}]}, "fc": {"anyOf": [{"type": "string"}, {"type": "null"}]},
}, },
}, },
"flags": { "flags": 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"}]},
},
},
"spec": {"type": "string"}, "spec": {"type": "string"},
"operating_system": {"type": "string"}, "operating_system": {"type": "string"},
"target": {"type": "string"}, "target": {"type": "string"},
@ -54,18 +63,9 @@
"modules": { "modules": {
"anyOf": [{"type": "string"}, {"type": "null"}, {"type": "array"}] "anyOf": [{"type": "string"}, {"type": "null"}, {"type": "array"}]
}, },
"implicit_rpaths": { "implicit_rpaths": implicit_rpaths,
"anyOf": [
{"type": "array", "items": {"type": "string"}},
{"type": "boolean"},
]
},
"environment": spack.schema.environment.definition, "environment": spack.schema.environment.definition,
"extra_rpaths": { "extra_rpaths": extra_rpaths,
"type": "array",
"default": [],
"items": {"type": "string"},
},
}, },
} }
}, },

View File

@ -11,6 +11,8 @@
import spack.schema.environment import spack.schema.environment
from .compilers import extra_rpaths, flags, implicit_rpaths
permissions = { permissions = {
"type": "object", "type": "object",
"additionalProperties": False, "additionalProperties": False,
@ -184,7 +186,16 @@
"type": "object", "type": "object",
"additionalProperties": True, "additionalProperties": True,
"properties": { "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,
}, },
}, },
}, },