def __init__(self, batch_system=None, machine=None, infile=None, files=None): """ initialize an object """ if files is None: files = Files() if infile is None: infile = files.get_value("BATCH_SPEC_FILE") schema = files.get_schema("BATCH_SPEC_FILE") GenericXML.__init__(self, infile, schema=schema) self.batch_system_node = None self.machine_node = None self.batch_system = batch_system self.machine = machine #Append the contents of $HOME/.cime/config_batch.xml if it exists #This could cause problems if node matchs are repeated when only one is expected infile = os.path.join(os.environ.get("HOME"), ".cime", "config_batch.xml") if os.path.exists(infile): GenericXML.read(self, infile) if self.batch_system is not None: self.set_batch_system(self.batch_system, machine=machine)
def __init__(self, batch_system=None, machine=None, infile=None, files=None): """ initialize an object """ if files is None: files = Files() if infile is None: infile = files.get_value("BATCH_SPEC_FILE") schema = files.get_schema("BATCH_SPEC_FILE") GenericXML.__init__(self, infile, schema=schema) self.batch_system_node = None self.machine_node = None self.batch_system = batch_system self.machine = machine #Append the contents of $HOME/.cime/config_batch.xml if it exists #This could cause problems if node matchs are repeated when only one is expected infile = os.path.join(os.environ.get("HOME"),".cime","config_batch.xml") if os.path.exists(infile): GenericXML.read(self, infile) if self.batch_system is not None: self.set_batch_system(self.batch_system, machine=machine)
def __init__(self, infile=None, files=None): """ initialize an object """ if files is None: files = Files() schema = files.get_schema("ARCHIVE_SPEC_FILE") super(Archive, self).__init__(infile, schema)
def __init__(self, infile, files=None): """ initialize a files object given input pes specification file """ if files is None: files = Files() schema = files.get_schema("PES_SPEC_FILE") logger.debug("DEBUG: infile is {}".format(infile)) GenericXML.__init__(self, infile, schema=schema)
def __init__(self,infile, files=None): """ initialize an object """ schema = None if files is None: files = Files() schema = files.get_schema("TESTS_SPEC_FILE") GenericXML.__init__(self, infile, schema=schema)
def __init__(self, infile=None, files=None): """ initialize an object """ if files is None: files = Files() schema = files.get_schema("ARCHIVE_SPEC_FILE") GenericXML.__init__(self, infile, schema)
def __init__(self, infile): """ initialize an object """ files = Files() schema = None # not checking schema on external components yet cimeroot = get_cime_root() if cimeroot in os.path.abspath(infile): schema = files.get_schema("CONFIG_CPL_FILE") EntryID.__init__(self, infile, schema=schema)
def __init__(self,infile, files=None): """ initialize an object """ schema = None if files is None: files = Files() schema = files.get_schema("TESTS_SPEC_FILE") GenericXML.__init__(self, infile, schema=schema) expect(self.get_version() >= 2.0, "{} is an unsupported version of the testfile format and will be ignored".format(infile))
def __init__(self, infile=None, files=None): if files is None: files = Files() if infile is None: infile = files.get_value("GRIDS_SPEC_FILE") logger.debug(" Grid specification file is %s" % infile) schema = files.get_schema("GRIDS_SPEC_FILE") GenericXML.__init__(self, infile, schema) self._version = self.get_version() self._comp_gridnames = self._get_grid_names()
def __init__(self, infile): """ initialize an object """ files = Files() schema = None # not checking schema on external components yet cimeroot = get_cime_root() if cimeroot in os.path.abspath(infile): schema = files.get_schema("CONFIG_DRV_FILE") EntryID.__init__(self, infile, schema=schema)
def __init__(self, infile): """ initialize an object """ files = Files() schema = files.get_schema("CONFIG_DRV_FILE") if schema is not None: # not checking schema on external components yet cimeroot = get_cime_root() if cimeroot in os.path.abspath(infile): self.validate_xml_file(infile, schema) EntryID.__init__(self, infile)
def __init__(self, infile=None, files=None): """ initialize a files object given input pes specification file """ if files is None: files = Files() if infile is None: infile = files.get_value("INPUTDATA_SPEC_FILE") schema = files.get_schema("INPUTDATA_SPEC_FILE") logger.debug("DEBUG: infile is {}".format(infile)) GenericXML.__init__(self, infile, schema=schema) self._servernode = None
def test_st_archive(self, testdir="st_archive_test"): files = Files() archive = Archive(files=files) components = [] # expect(not self.get_value("MULTI_DRIVER"),"Test not configured for multi-driver cases") config_archive_files = archive.get_all_config_archive_files(files) # create the run directory testdir and populate it with rest_file and hist_file from # config_archive.xml test_file_names if os.path.exists(testdir): logger.info("Removing existing test directory {}".format(testdir)) shutil.rmtree(testdir) dout_s_root=os.path.join(testdir,"archive") archive = Archive() schema = files.get_schema("ARCHIVE_SPEC_FILE") for config_archive_file in config_archive_files: archive.read(config_archive_file, schema) comp_archive_specs = archive.get_children("comp_archive_spec") for comp_archive_spec in comp_archive_specs: components.append(archive.get(comp_archive_spec, 'compname')) test_file_names = archive.get_optional_child("test_file_names", root=comp_archive_spec) if test_file_names is not None: if not os.path.exists(testdir): os.makedirs(os.path.join(testdir,"archive")) for file_node in archive.get_children("tfile", root=test_file_names): fname = os.path.join(testdir,archive.text(file_node)) disposition = archive.get(file_node, "disposition") logger.info("Create file {} with disposition {}". format(fname, disposition)) with open(fname, 'w') as fd: fd.write(disposition+"\n") logger.info("testing components: {} ".format(list(set(components)))) _archive_process(self, archive, None, False, False,components=list(set(components)), dout_s_root=dout_s_root, casename="casename", rundir=testdir, testonly=True) _check_disposition(testdir) # Now test the restore capability testdir2 = os.path.join(testdir,"run2") os.makedirs(testdir2) restore_from_archive(self, rundir=testdir2, dout_s_root=dout_s_root, test=True) restfiles = [f for f in os.listdir(os.path.join(testdir,"archive","rest","1976-01-01-00000"))] for _file in restfiles: expect(os.path.isfile(os.path.join(testdir2,_file)), "Expected file {} to be restored from rest dir".format(_file)) return True
def __init__(self, machobj, infile=None, compiler=None, mpilib=None, files=None, version=None): """ initialize an object """ if infile is None: if files is None: files = Files() infile = files.get_value("COMPILERS_SPEC_FILE") schema = files.get_schema("COMPILERS_SPEC_FILE") GenericXML.__init__(self, infile, schema) self._machobj = machobj if version is not None: # this is used in scripts_regression_tests to force version 2, it should not be used otherwise self._version = version else: self._version = self.get_version() self.machine = machobj.get_machine_name() self.os = machobj.get_value("OS") if mpilib is None: mpilib = machobj.get_default_MPIlib() self.mpilib = mpilib if compiler is None: compiler = machobj.get_default_compiler() self.compiler = compiler self.compiler_nodes = None # Listed from last to first #Append the contents of $HOME/.cime/config_compilers.xml if it exists #This could cause problems if node matchs are repeated when only one is expected infile = os.path.join(os.environ.get("HOME"), ".cime", "config_compilers.xml") if os.path.exists(infile): GenericXML.read(self, infile) if self.compiler is not None: self.set_compiler(compiler) if self._version != "1.0": # Run an XPath query to extract the list of flag variable names. ns = {"xs": "http://www.w3.org/2001/XMLSchema"} flag_xpath = ".//xs:group[@name='compilerVars']/xs:choice/xs:element[@type='flagsVar']" flag_elems = ET.parse(schema).getroot().findall(flag_xpath, ns) self.flag_vars = set(elem.get('name') for elem in flag_elems)
def test_st_archive(self, testdir="st_archive_test"): archive = Archive() files = Files() components = [] # expect(not self.get_value("MULTI_DRIVER"),"Test not configured for multi-driver cases") config_archive_files = archive.get_all_config_archive_files(files) # create the run directory testdir and populate it with rest_file and hist_file from # config_archive.xml test_file_names if os.path.exists(testdir): logger.info("Removing existing test directory {}".format(testdir)) shutil.rmtree(testdir) dout_s_root=os.path.join(testdir,"archive") archive = Archive() schema = files.get_schema("ARCHIVE_SPEC_FILE") for config_archive_file in config_archive_files: archive.read(config_archive_file, schema) comp_archive_specs = archive.get_children("comp_archive_spec") for comp_archive_spec in comp_archive_specs: components.append(archive.get(comp_archive_spec, 'compname')) test_file_names = archive.get_optional_child("test_file_names", root=comp_archive_spec) if test_file_names is not None: if not os.path.exists(testdir): os.makedirs(os.path.join(testdir,"archive")) for file_node in archive.get_children("tfile", root=test_file_names): fname = os.path.join(testdir,archive.text(file_node)) disposition = archive.get(file_node, "disposition") logger.info("Create file {} with disposition {}". format(fname, disposition)) with open(fname, 'w') as fd: fd.write(disposition+"\n") logger.info("testing components: {} ".format(list(set(components)))) _archive_process(self, archive, None, False, False,components=list(set(components)), dout_s_root=dout_s_root, casename="casename", rundir=testdir, testonly=True) _check_disposition(testdir) # Now test the restore capability testdir2 = os.path.join(testdir,"run2") os.makedirs(testdir2) restore_from_archive(self, rundir=testdir2, dout_s_root=dout_s_root) restfiles = [f for f in os.listdir(os.path.join(testdir,"archive","rest","1976-01-01-00000"))] for _file in restfiles: expect(os.path.isfile(os.path.join(testdir2,_file)), "Expected file {} to be restored from rest dir".format(_file)) return True
def __init__(self, infile=None, files=None, comp_interface=None): if files is None: files = Files(comp_interface=comp_interface) if infile is None: infile = files.get_value("GRIDS_SPEC_FILE") logger.debug(" Grid specification file is {}".format(infile)) schema = files.get_schema("GRIDS_SPEC_FILE") try: GenericXML.__init__(self, infile, schema) except: expect(False, "Could not initialize Grids") self._version = self.get_version() self._comp_gridnames = self._get_grid_names()
def __init__(self, infile, comp_class): """ initialize a Component obect from the component xml file in infile associate the component class with comp_class if provided. """ self._comp_class = comp_class if infile == 'testingonly': self.filename = infile return files = Files() schema = None EntryID.__init__(self, infile) schema = files.get_schema("CONFIG_{}_FILE".format(comp_class), attributes={"version":"{}".format(self.get_version())}) if schema is not None: self.validate_xml_file(infile, schema)
def __init__( self, batch_system=None, machine=None, infile=None, files=None, extra_machines_dir=None, ): """ initialize an object If extra_machines_dir is provided, it should be a string giving a path to an additional directory that will be searched for a config_batch.xml file; if found, the contents of this file will be appended to the standard config_batch.xml. An empty string is treated the same as None. """ if files is None: files = Files() if infile is None: infile = files.get_value("BATCH_SPEC_FILE") schema = files.get_schema("BATCH_SPEC_FILE") GenericXML.__init__(self, infile, schema=schema) self.batch_system_node = None self.machine_node = None self.batch_system = batch_system self.machine = machine # Append the contents of $HOME/.cime/config_batch.xml if it exists. # # Also append the contents of a config_batch.xml file in the directory given by # extra_machines_dir, if present. # # This could cause problems if node matches are repeated when only one is expected. infile = os.path.join(os.environ.get("HOME"), ".cime", "config_batch.xml") if os.path.exists(infile): GenericXML.read(self, infile) if extra_machines_dir: infile = os.path.join(extra_machines_dir, "config_batch.xml") if os.path.exists(infile): GenericXML.read(self, infile) if self.batch_system is not None: self.set_batch_system(self.batch_system, machine=machine)
def __init__(self, machobj, infile=None, compiler=None, mpilib=None, files=None, version=None): """ initialize an object """ if infile is None: if files is None: files = Files() infile = files.get_value("COMPILERS_SPEC_FILE") schema = files.get_schema("COMPILERS_SPEC_FILE") GenericXML.__init__(self, infile, schema) self._machobj = machobj if version is not None: # this is used in scripts_regression_tests to force version 2, it should not be used otherwise self._version = version else: self._version = self.get_version() self.machine = machobj.get_machine_name() self.os = machobj.get_value("OS") if compiler is None: compiler = machobj.get_default_compiler() self.compiler = compiler if mpilib is None: if compiler is None: mpilib = machobj.get_default_MPIlib() else: mpilib = machobj.get_default_MPIlib(attributes={'compiler':compiler}) self.mpilib = mpilib self.compiler_nodes = None # Listed from last to first #Append the contents of $HOME/.cime/config_compilers.xml if it exists #This could cause problems if node matchs are repeated when only one is expected infile = os.path.join(os.environ.get("HOME"),".cime","config_compilers.xml") if os.path.exists(infile): GenericXML.read(self, infile) if self.compiler is not None: self.set_compiler(compiler) if self._version > 1.0: schema_db = GenericXML(infile=schema) compiler_vars = schema_db.get_child("{http://www.w3.org/2001/XMLSchema}group", attributes={"name":"compilerVars"}) choice = schema_db.get_child(name="{http://www.w3.org/2001/XMLSchema}choice", root=compiler_vars) self.flag_vars = set(schema_db.get(elem, "name") for elem in schema_db.get_children(root=choice, attributes={"type":"flagsVar"}))
def __init__(self, infile=None, files=None, machine=None): """ initialize an object if a filename is provided it will be used, otherwise if a files object is provided it will be used otherwise create a files object from default values """ self.machine_node = None self.machine = None self.machines_dir = None self.custom_settings = {} schema = None if files is None: files = Files() if infile is None: infile = files.get_value("MACHINES_SPEC_FILE") schema = files.get_schema("MACHINES_SPEC_FILE") logger.debug("Verifying using schema {}".format(schema)) self.machines_dir = os.path.dirname(infile) GenericXML.__init__(self, infile, schema) # Append the contents of $HOME/.cime/config_machines.xml if it exists # This could cause problems if node matchs are repeated when only one is expected local_infile = os.path.join(os.environ.get("HOME"), ".cime", "config_machines.xml") logger.debug("Infile: {}".format(local_infile)) if os.path.exists(local_infile): GenericXML.read(self, local_infile, schema) if machine is None: if "CIME_MACHINE" in os.environ: machine = os.environ["CIME_MACHINE"] else: cime_config = get_cime_config() if cime_config.has_option("main", "machine"): machine = cime_config.get("main", "machine") if machine is None: machine = self.probe_machine_name() expect( machine is not None, "Could not initialize machine object from {} or {}".format( infile, local_infile)) self.set_machine(machine)
def __init__(self, infile): """ initialize an object """ files = Files() # use xmllint to validate infile xmllint = find_executable("xmllint") if xmllint is not None: # all components refer to the same schema so referencing config_drv_file is okay schema = files.get_schema("CONFIG_DRV_FILE") if schema is not None: logger.debug("Checking file %s against %s" % (infile, schema)) run_cmd_no_fail("%s --noout --schema %s %s" % (xmllint, schema, infile)) EntryID.__init__(self, infile)
def __init__(self, machobj, infile=None, compiler=None, mpilib=None, files=None, version=None): """ initialize an object """ if infile is None: if files is None: files = Files() infile = files.get_value("COMPILERS_SPEC_FILE") schema = files.get_schema("COMPILERS_SPEC_FILE") GenericXML.__init__(self, infile, schema) self._machobj = machobj if version is not None: # this is used in scripts_regression_tests to force version 2, it should not be used otherwise self._version = version else: self._version = self.get_version() self.machine = machobj.get_machine_name() self.os = machobj.get_value("OS") if mpilib is None: mpilib = machobj.get_default_MPIlib() self.mpilib = mpilib if compiler is None: compiler = machobj.get_default_compiler() self.compiler = compiler self.compiler_nodes = None # Listed from last to first #Append the contents of $HOME/.cime/config_compilers.xml if it exists #This could cause problems if node matchs are repeated when only one is expected infile = os.path.join(os.environ.get("HOME"),".cime","config_compilers.xml") if os.path.exists(infile): GenericXML.read(self, infile) if self.compiler is not None: self.set_compiler(compiler) if self._version > 1.0: # Run an XPath query to extract the list of flag variable names. ns = {"xs": "http://www.w3.org/2001/XMLSchema"} flag_xpath = ".//xs:group[@name='compilerVars']/xs:choice/xs:element[@type='flagsVar']" flag_elems = ET.parse(schema).getroot().findall(flag_xpath, ns) self.flag_vars = set(elem.get('name') for elem in flag_elems)
def __init__(self, infile, files=None): """Construct a `NamelistDefinition` from an XML file.""" # if the file is invalid we may not be able to check the version # but we need to do it this way until we remove the version 1 files schema = None if files is None: files = Files() schema = files.get_schema("NAMELIST_DEFINITION_FILE") expect(os.path.isfile(infile), "File {} does not exist".format(infile)) super(NamelistDefinition, self).__init__(infile, schema=schema) self._attributes = {} self._entry_nodes = [] self._entry_ids = [] self._valid_values = {} self._entry_types = {} self._group_names = {} self._nodes = {}
def __init__(self, infile, files=None): """Construct a `NamelistDefinition` from an XML file.""" # if the file is invalid we may not be able to check the version # but we need to do it this way until we remove the version 1 files schema = None if files is None: files = Files() schema = files.get_schema("NAMELIST_DEFINITION_FILE") expect(os.path.isfile(infile), "File %s does not exist"%infile) super(NamelistDefinition, self).__init__(infile, schema=schema) self._attributes = {} self._entry_nodes = [] self._entry_ids = [] self._valid_values = {} self._entry_types = {} self._group_names = {} self._nodes = {}
def __init__(self, infile=None, files=None): """ initialize an object """ if files is None: files = Files() if infile is None: infile = files.get_value("WORKFLOW_SPEC_FILE") expect(infile, "No workflow file defined in {}".format(files.filename)) schema = files.get_schema("WORKFLOW_SPEC_FILE") GenericXML.__init__(self, infile, schema=schema) #Append the contents of $HOME/.cime/config_workflow.xml if it exists #This could cause problems if node matchs are repeated when only one is expected infile = os.path.join(os.environ.get("HOME"),".cime","config_workflow.xml") if os.path.exists(infile): GenericXML.read(self, infile)
def __init__(self, infile=None, files=None, machine=None): """ initialize an object if a filename is provided it will be used, otherwise if a files object is provided it will be used otherwise create a files object from default values """ self.machine_node = None self.machine = None self.machines_dir = None schema = None if files is None: files = Files() if infile is None: infile = files.get_value("MACHINES_SPEC_FILE") schema = files.get_schema("MACHINES_SPEC_FILE") logger.debug("Verifying using schema {}".format(schema)) self.machines_dir = os.path.dirname(infile) GenericXML.__init__(self, infile, schema) # Append the contents of $HOME/.cime/config_machines.xml if it exists # This could cause problems if node matchs are repeated when only one is expected local_infile = os.path.join(os.environ.get("HOME"),".cime","config_machines.xml") logger.debug("Infile: {}".format(local_infile)) if os.path.exists(local_infile): GenericXML.read(self, local_infile, schema) if machine is None: if "CIME_MACHINE" in os.environ: machine = os.environ["CIME_MACHINE"] else: cime_config = get_cime_config() if cime_config.has_option("main", "machine"): machine = cime_config.get("main", "machine") if machine is None: machine = self.probe_machine_name() expect(machine is not None, "Could not initialize machine object from {} or {}".format(infile, local_infile)) self.set_machine(machine)
def __init__(self, infile=None, files=None): if files is None: files = Files() schema = files.get_schema("COMPSETS_SPEC_FILE") GenericXML.__init__(self, infile, schema=schema)
def __init__( self, machobj, infile=None, compiler=None, mpilib=None, files=None, version=None, extra_machines_dir=None, ): """ initialize an object If extra_machines_dir is provided, it should be a string giving a path to an additional directory that will be searched for a config_compilers.xml file; if found, the contents of this file will be appended to the standard config_compilers.xml. An empty string is treated the same as None. """ expect( "CIME_NO_CMAKE_MACRO" in os.environ, "Should not be using config_compilers.xml without CIME_NO_CMAKE_MACRO", ) if infile is None: if files is None: files = Files() infile = files.get_value("COMPILERS_SPEC_FILE") schema = files.get_schema("COMPILERS_SPEC_FILE") GenericXML.__init__(self, infile, schema) if version is not None: # this is used in scripts_regression_tests to force version 2, it should not be used otherwise self._version = version else: self._version = self.get_version() self._machobj = machobj self.machine = machobj.get_machine_name() self.os = machobj.get_value("OS") if compiler is None: compiler = machobj.get_default_compiler() self.compiler = compiler if mpilib is None: if compiler is None: mpilib = machobj.get_default_MPIlib() else: mpilib = machobj.get_default_MPIlib(attributes={"compiler": compiler}) self.mpilib = mpilib self.compiler_nodes = None # Listed from last to first # Append the contents of $HOME/.cime/config_compilers.xml if it exists. # # Also append the contents of a config_compilers.xml file in the directory given by # extra_machines_dir, if present. # # This could cause problems if node matches are repeated when only one is expected. infile = os.path.join(os.environ.get("HOME"), ".cime", "config_compilers.xml") if os.path.exists(infile): GenericXML.read(self, infile, schema=schema) if extra_machines_dir: infile = os.path.join(extra_machines_dir, "config_compilers.xml") if os.path.exists(infile): GenericXML.read(self, infile, schema=schema) if self.compiler is not None: self.set_compiler(compiler) if self._version > 1.0: schema_db = GenericXML(infile=schema) compiler_vars = schema_db.get_child( "{http://www.w3.org/2001/XMLSchema}group", attributes={"name": "compilerVars"}, ) choice = schema_db.get_child( name="{http://www.w3.org/2001/XMLSchema}choice", root=compiler_vars ) self.flag_vars = set( schema_db.get(elem, "name") for elem in schema_db.get_children( root=choice, attributes={"type": "flagsVar"} ) )
def __init__(self, infile=None, files=None, machine=None, extra_machines_dir=None): """ initialize an object if a filename is provided it will be used, otherwise if a files object is provided it will be used otherwise create a files object from default values If extra_machines_dir is provided, it should be a string giving a path to an additional directory that will be searched for a config_machines.xml file; if found, the contents of this file will be appended to the standard config_machines.xml. An empty string is treated the same as None. """ self.machine_node = None self.machine = None self.machines_dir = None self.custom_settings = {} schema = None if files is None: files = Files() if infile is None: infile = files.get_value("MACHINES_SPEC_FILE") schema = files.get_schema("MACHINES_SPEC_FILE") logger.debug("Verifying using schema {}".format(schema)) self.machines_dir = os.path.dirname(infile) GenericXML.__init__(self, infile, schema) # Append the contents of $HOME/.cime/config_machines.xml if it exists. # # Also append the contents of a config_machines.xml file in the directory given by # extra_machines_dir, if present. # # This could cause problems if node matches are repeated when only one is expected. local_infile = os.path.join(os.environ.get("HOME"), ".cime", "config_machines.xml") logger.debug("Infile: {}".format(local_infile)) if os.path.exists(local_infile): GenericXML.read(self, local_infile, schema) if extra_machines_dir: local_infile = os.path.join(extra_machines_dir, "config_machines.xml") logger.debug("Infile: {}".format(local_infile)) if os.path.exists(local_infile): GenericXML.read(self, local_infile, schema) if machine is None: if "CIME_MACHINE" in os.environ: machine = os.environ["CIME_MACHINE"] else: cime_config = get_cime_config() if cime_config.has_option("main", "machine"): machine = cime_config.get("main", "machine") if machine is None: machine = self.probe_machine_name() expect( machine is not None, "Could not initialize machine object from {} or {}".format( infile, local_infile)) self.set_machine(machine)
def __init__(self, machobj, infile=None, compiler=None, mpilib=None, files=None, version=None): """ initialize an object """ if infile is None: if files is None: files = Files() infile = files.get_value("COMPILERS_SPEC_FILE") schema = files.get_schema("COMPILERS_SPEC_FILE") GenericXML.__init__(self, infile, schema) self._machobj = machobj if version is not None: # this is used in scripts_regression_tests to force version 2, it should not be used otherwise self._version = version else: self._version = self.get_version() self.machine = machobj.get_machine_name() self.os = machobj.get_value("OS") if compiler is None: compiler = machobj.get_default_compiler() self.compiler = compiler if mpilib is None: if compiler is None: mpilib = machobj.get_default_MPIlib() else: mpilib = machobj.get_default_MPIlib( attributes={'compiler': compiler}) self.mpilib = mpilib self.compiler_nodes = None # Listed from last to first #Append the contents of $HOME/.cime/config_compilers.xml if it exists #This could cause problems if node matchs are repeated when only one is expected infile = os.path.join(os.environ.get("HOME"), ".cime", "config_compilers.xml") if os.path.exists(infile): GenericXML.read(self, infile) if self.compiler is not None: self.set_compiler(compiler) if self._version > 1.0: schema_db = GenericXML(infile=schema) compiler_vars = schema_db.get_child( "{http://www.w3.org/2001/XMLSchema}group", attributes={"name": "compilerVars"}) choice = schema_db.get_child( name="{http://www.w3.org/2001/XMLSchema}choice", root=compiler_vars) self.flag_vars = set( schema_db.get(elem, "name") for elem in schema_db.get_children( root=choice, attributes={"type": "flagsVar"}))
def __init__(self, infile=None, files=None): if files is None: files = Files() schema = files.get_schema("COMPSETS_SPEC_FILE") GenericXML.__init__(self, infile, schema=schema) self.groups = {}