From 94207b3e7b38e4ac9a4fde75861324653de1b10e Mon Sep 17 00:00:00 2001 From: Jim Edwards Date: Fri, 28 Apr 2023 07:39:29 -0600 Subject: [PATCH] do not allow EXEROOT or OBJDIR or LIBROOT to be CASEROOT --- CIME/XML/env_build.py | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/CIME/XML/env_build.py b/CIME/XML/env_build.py index 7bd805b1c0f..fe863e414ef 100644 --- a/CIME/XML/env_build.py +++ b/CIME/XML/env_build.py @@ -18,4 +18,19 @@ def __init__( initialize an object interface to file env_build.xml in the case directory """ schema = os.path.join(utils.get_schema_path(), "env_entry_id.xsd") + self._caseroot = case_root EnvBase.__init__(self, case_root, infile, schema=schema, read_only=read_only) + + def set_value(self, vid, value, subgroup=None, ignore_type=False): + """ + Set the value of an entry-id field to value + Returns the value or None if not found + subgroup is ignored in the general routine and applied in specific methods + """ + # Do not allow any of these to be the same as CASEROOT + if vid in ("EXEROOT", "OBJDIR", "LIBROOT"): + utils.expect(value != self._caseroot, f"Cannot set {vid} to CASEROOT") + + return super(EnvBuild, self).set_value( + vid, value, subgroup=subgroup, ignore_type=ignore_type + )