Add schema for compiler options in packages.yaml (#45738)
This commit is contained in:
		
				
					committed by
					
						
						GitHub
					
				
			
			
				
	
			
			
			
						parent
						
							7b10aae356
						
					
				
				
					commit
					97ffe2e575
				
			@@ -11,6 +11,26 @@
 | 
			
		||||
 | 
			
		||||
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 @@
 | 
			
		||||
                                "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 @@
 | 
			
		||||
                        "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,
 | 
			
		||||
                    },
 | 
			
		||||
                }
 | 
			
		||||
            },
 | 
			
		||||
 
 | 
			
		||||
@@ -11,6 +11,8 @@
 | 
			
		||||
 | 
			
		||||
import spack.schema.environment
 | 
			
		||||
 | 
			
		||||
from .compilers import extra_rpaths, flags, implicit_rpaths
 | 
			
		||||
 | 
			
		||||
permissions = {
 | 
			
		||||
    "type": "object",
 | 
			
		||||
    "additionalProperties": False,
 | 
			
		||||
@@ -184,7 +186,16 @@
 | 
			
		||||
                                    "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,
 | 
			
		||||
                                    },
 | 
			
		||||
                                },
 | 
			
		||||
                            },
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user