@@ -64,11 +64,9 @@ def __init__(self, name: str, errors: list[jsonschema.ValidationError]):
6464
6565
6666class SchemaValidator :
67- def __init__ (self , schema_filepath : pathlib .Path , precheck = None , postcheck = None , postcheck_args = () ):
67+ def __init__ (self , schema_filepath : pathlib .Path , precheck = None ):
6868 self ._validator = validator (json .load (open (schema_filepath )))
6969 self ._precheck = precheck
70- self ._postcheck = postcheck
71- self ._postcheck_args = postcheck_args
7270
7371 def validate (self , instance : dict ):
7472 if self ._precheck :
@@ -79,9 +77,6 @@ def validate(self, instance: dict):
7977 if len (errors ) != 0 :
8078 raise ValidationError (self ._validator .schema .get ("title" , "no-title" ), errors )
8179
82- if self ._postcheck :
83- self ._postcheck (instance , * self ._postcheck_args )
84-
8580
8681def check_config_version (instance ):
8782 rversion = instance .get ("version" , 1 )
@@ -117,18 +112,4 @@ def check_config_version(instance):
117112CompilersValidator = SchemaValidator (prefix / "schema/compilers.json" )
118113EnvironmentsValidator = SchemaValidator (prefix / "schema/environments.json" )
119114CacheValidator = SchemaValidator (prefix / "schema/cache.json" )
120-
121-
122- def modules_constraints (instance : dict , mount : pathlib .Path ):
123- # Note:
124- # modules root should match MODULEPATH set by envvars and used by uenv view "modules"
125- # so we enforce that the user does not override it in modules.yaml
126- instance ["modules" ].setdefault ("default" , {}).setdefault ("roots" , {}).setdefault (
127- "tcl" , (mount / "modules" ).as_posix ()
128- )
129-
130-
131- def ModulesValidator (mountpoint ):
132- return SchemaValidator (
133- prefix / "schema/modules.json" , None , postcheck = modules_constraints , postcheck_args = (mountpoint ,)
134- )
115+ ModulesValidator = SchemaValidator (prefix / "schema/modules.json" )
0 commit comments