Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CIME/XML/archive_base.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
"""
Base class for archive files. This class inherits from generic_xml.py
"""

from CIME.XML.standard_module_setup import *
from CIME.XML.generic_xml import GenericXML
from CIME.utils import convert_to_type
Expand Down
9 changes: 6 additions & 3 deletions CIME/XML/batch.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,11 @@
The batch_system type="foo" blocks define most things. Machine-specific overrides
can be defined by providing a batch_system MACH="mach" block.
"""

from CIME.XML.standard_module_setup import *
from CIME.XML.generic_xml import GenericXML
from CIME.XML.files import Files
from CIME.utils import expect
from CIME.utils import expect, get_config_dir

logger = logging.getLogger(__name__)

Expand Down Expand Up @@ -45,13 +46,15 @@ def __init__(
self.batch_system = batch_system
self.machine = machine

# Append the contents of $HOME/.cime/config_batch.xml if it exists.
# Append the contents of $HOME/get_config_dir()/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")
infile = os.path.join(
os.environ.get("HOME"), get_config_dir(), "config_batch.xml"
)
usehome = False
if os.path.exists(infile):
GenericXML.read(self, infile)
Expand Down
1 change: 1 addition & 0 deletions CIME/XML/component.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
"""
Interface to the config_component.xml files. This class inherits from EntryID.py
"""

from CIME.XML.standard_module_setup import *

from CIME.XML.entry_id import EntryID
Expand Down
1 change: 1 addition & 0 deletions CIME/XML/entry_id.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
this is an abstract class and is expected to
be used by other XML interface modules and not directly.
"""

from CIME.XML.standard_module_setup import *
from CIME.utils import expect, convert_to_string, convert_to_type
from CIME.XML.generic_xml import GenericXML
Expand Down
3 changes: 3 additions & 0 deletions CIME/XML/env_archive.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,15 @@
"""
Interface to the env_archive.xml file. This class inherits from EnvBase
"""

from CIME.XML.standard_module_setup import *
from CIME import utils
from CIME.XML.archive_base import ArchiveBase
from CIME.XML.env_base import EnvBase

logger = logging.getLogger(__name__)


# pylint: disable=super-init-not-called
class EnvArchive(ArchiveBase, EnvBase):
def __init__(self, case_root=None, infile="env_archive.xml", read_only=False):
Expand Down
1 change: 1 addition & 0 deletions CIME/XML/env_base.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
"""
Base class for env files. This class inherits from EntryID.py
"""

from CIME.XML.standard_module_setup import *
from CIME.XML.entry_id import EntryID
from CIME.XML.headers import Headers
Expand Down
3 changes: 2 additions & 1 deletion CIME/XML/env_batch.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
get_logging_options,
format_time,
add_flag_to_cmd,
get_config_dir,
)
from collections import OrderedDict
import stat, re, math
Expand Down Expand Up @@ -632,7 +633,7 @@ def _get_arg_nodes(self, case, bs_nodes):
check_paths = [case.get_value("BATCH_SPEC_FILE")]

user_config_path = os.path.join(
pathlib.Path().home(), ".cime", "config_batch.xml"
pathlib.Path().home(), get_config_dir(), "config_batch.xml"
)

if os.path.exists(user_config_path):
Expand Down
1 change: 1 addition & 0 deletions CIME/XML/env_build.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
"""
Interface to the env_build.xml file. This class inherits from EnvBase
"""

from CIME.XML.standard_module_setup import *

from CIME import utils
Expand Down
1 change: 1 addition & 0 deletions CIME/XML/env_case.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
"""
Interface to the env_case.xml file. This class inherits from EnvBase
"""

from CIME.XML.standard_module_setup import *

from CIME import utils
Expand Down
1 change: 1 addition & 0 deletions CIME/XML/env_mach_pes.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
"""
Interface to the env_mach_pes.xml file. This class inherits from EntryID
"""

from CIME.XML.standard_module_setup import *
from CIME import utils
from CIME.XML.env_base import EnvBase
Expand Down
2 changes: 2 additions & 0 deletions CIME/XML/env_mach_specific.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
"""
Interface to the env_mach_specific.xml file. This class inherits from EnvBase
"""

from CIME.XML.standard_module_setup import *

from CIME.XML.env_base import EnvBase
Expand All @@ -11,6 +12,7 @@

logger = logging.getLogger(__name__)


# Is not of type EntryID but can use functions from EntryID (e.g
# get_type) otherwise need to implement own functions and make GenericXML parent class
class EnvMachSpecific(EnvBase):
Expand Down
1 change: 1 addition & 0 deletions CIME/XML/env_postprocessing.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
"""
Interface to the env_postprocessing.xml file. This class inherits from EnvBase
"""

from CIME.XML.standard_module_setup import *

from CIME.XML.env_base import EnvBase
Expand Down
1 change: 1 addition & 0 deletions CIME/XML/env_run.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
"""
Interface to the env_run.xml file. This class inherits from EnvBase
"""

from CIME.XML.standard_module_setup import *

from CIME.XML.env_base import EnvBase
Expand Down
1 change: 1 addition & 0 deletions CIME/XML/env_test.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
"""
Interface to the env_test.xml file. This class inherits from EnvBase
"""

from CIME.XML.standard_module_setup import *

from CIME.XML.env_base import EnvBase
Expand Down
21 changes: 13 additions & 8 deletions CIME/XML/generic_xml.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
Common interface to XML files, this is an abstract class and is expected to
be used by other XML interface modules and not directly.
"""

from CIME.XML.standard_module_setup import *
from CIME.utils import safe_copy, get_src_root

Expand Down Expand Up @@ -399,10 +400,12 @@ def get_child(self, name=None, attributes=None, root=None, err_msg=None):
)
expect(
child,
err_msg
if err_msg
else "Expected one child, found None with name '{}' and attribs '{}' in file {}".format(
name, attributes, self.filename
(
err_msg
if err_msg
else "Expected one child, found None with name '{}' and attribs '{}' in file {}".format(
name, attributes, self.filename
)
),
)
return child
Expand All @@ -419,10 +422,12 @@ def get_optional_child(self, name=None, attributes=None, root=None, err_msg=None

expect(
len(children) <= 1,
err_msg
if err_msg
else "Multiple matches for name '{}' and attribs '{}' in file {}".format(
name, attributes, self.filename
(
err_msg
if err_msg
else "Multiple matches for name '{}' and attribs '{}' in file {}".format(
name, attributes, self.filename
)
),
)
return children[0] if children else None
Expand Down
1 change: 1 addition & 0 deletions CIME/XML/headers.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
"""
Interface to the config_headers.xml file. This class inherits from EntryID.py
"""

from CIME.XML.standard_module_setup import *

from CIME.XML.generic_xml import GenericXML
Expand Down
1 change: 1 addition & 0 deletions CIME/XML/inputdata.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
"""
Interface to the config_inputdata.xml file. This class inherits from GenericXML.py
"""

from CIME.XML.standard_module_setup import *
from CIME.XML.generic_xml import GenericXML
from CIME.XML.files import Files
Expand Down
16 changes: 12 additions & 4 deletions CIME/XML/machines.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,13 @@
from CIME.XML.standard_module_setup import *
from CIME.XML.generic_xml import GenericXML
from CIME.XML.files import Files
from CIME.utils import CIMEError, expect, convert_to_unknown_type, get_cime_config
from CIME.utils import (
CIMEError,
expect,
convert_to_unknown_type,
get_cime_config,
get_config_dir,
)

import re
import logging
Expand Down Expand Up @@ -99,14 +105,14 @@ def __init__(

GenericXML.__init__(self, infile, schema, read_only=read_only)

# Append the contents of $HOME/.cime/config_machines.xml if it exists.
# Append the contents of $HOME/get_config_dir()/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"
os.environ.get("HOME"), get_config_dir(), "config_machines.xml"
)
logger.debug("Infile: {}".format(local_infile))

Expand Down Expand Up @@ -349,7 +355,9 @@ def set_machine(self, machine, schema=None):
if machine == "Query":
return machine
elif self.get_version() == 3:
machines_file = Path.home() / ".cime" / machine / "config_machines.xml"
machines_file = (
Path.home() / get_config_dir() / machine / "config_machines.xml"
)

if machines_file.exists():
GenericXML.read(
Expand Down
2 changes: 0 additions & 2 deletions CIME/XML/namelist_definition.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@


class CaseInsensitiveDict(dict):

"""Basic case insensitive dict with strings only keys.
From https://stackoverflow.com/a/27890005"""

Expand Down Expand Up @@ -65,7 +64,6 @@ def __setitem__(self, k, v):


class NamelistDefinition(EntryID):

"""Class representing variable definitions for a namelist.
This class inherits from `EntryID`, and supports most inherited methods;
however, `set_value` is unsupported.
Expand Down
1 change: 1 addition & 0 deletions CIME/XML/pes.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
"""
Interface to the config_pes.xml file. This class inherits from GenericXML.py
"""

from CIME.XML.standard_module_setup import *
from CIME.XML.generic_xml import GenericXML
from CIME.XML.files import Files
Expand Down
1 change: 1 addition & 0 deletions CIME/XML/pio.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
"""
Class for config_pio files . This class inherits from EntryID.py
"""

from CIME.XML.standard_module_setup import *
from CIME.XML.entry_id import EntryID
from CIME.XML.files import Files
Expand Down
6 changes: 3 additions & 3 deletions CIME/XML/postprocessing.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
from CIME.XML.standard_module_setup import *
from CIME.XML.entry_id import EntryID
from CIME.XML.files import Files
from CIME.utils import expect
from CIME.utils import expect, get_config_dir

logger = logging.getLogger(__name__)

Expand All @@ -31,10 +31,10 @@ def __init__(self, infile=None, files=None):

EntryID.__init__(self, infile, schema=schema)

# Append the contents of $HOME/.cime/config_postprocessing.xml if it exists
# Append the contents of $HOME/get_config_dir()/config_postprocessing.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_postprocessing.xml"
os.environ.get("HOME"), get_config_dir(), "config_postprocessing.xml"
)
if os.path.exists(infile):
EntryID.read(self, infile)
1 change: 1 addition & 0 deletions CIME/XML/stream.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@

stream files predate cime and so do not conform to entry id format
"""

from CIME.XML.standard_module_setup import *
from CIME.XML.generic_xml import GenericXML
from CIME.XML.files import Files
Expand Down
1 change: 1 addition & 0 deletions CIME/XML/test_reporter.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
Interface to the testreporter xml. This class inherits from GenericXML.py

"""

# pylint: disable=import-error
import urllib.parse
import urllib.request
Expand Down
1 change: 1 addition & 0 deletions CIME/XML/testlist.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@

- workflow: adds a workflow to the test
"""

from CIME.XML.standard_module_setup import *

from CIME.XML.generic_xml import GenericXML
Expand Down
1 change: 1 addition & 0 deletions CIME/XML/tests.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
"""
Interface to the config_tests.xml file. This class inherits from GenericEntry
"""

from CIME.XML.standard_module_setup import *

from CIME.XML.generic_xml import GenericXML
Expand Down
1 change: 1 addition & 0 deletions CIME/XML/testspec.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
"""
Interface to the testspec.xml file. This class inherits from generic_xml.py
"""

from CIME.XML.standard_module_setup import *

from CIME.XML.generic_xml import GenericXML
Expand Down
8 changes: 5 additions & 3 deletions CIME/XML/workflow.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
from CIME.XML.standard_module_setup import *
from CIME.XML.generic_xml import GenericXML
from CIME.XML.files import Files
from CIME.utils import expect
from CIME.utils import expect, get_config_dir

logger = logging.getLogger(__name__)

Expand All @@ -25,9 +25,11 @@ def __init__(self, infile=None, files=None):

GenericXML.__init__(self, infile, schema=schema)

# Append the contents of $HOME/.cime/config_workflow.xml if it exists
# Append the contents of $HOME/get_config_dir()/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")
infile = os.path.join(
os.environ.get("HOME"), get_config_dir(), "config_workflow.xml"
)
if os.path.exists(infile):
GenericXML.read(self, infile)

Expand Down
6 changes: 5 additions & 1 deletion CIME/build_scripts/buildlib.pio
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,11 @@ def buildlib(bldroot, installpath, case):
elif pio_version == 1:
cmake_opts = '"-D GENF90_PATH=$CIMEROOT/CIME/non_py/externals/genf90 "'
else:
cmake_opts = '"-D GENF90_PATH=' + srcroot + '/libraries/parallelio/scripts/ "'
cmake_opts = (
'"-DCMAKE_POLICY_VERSION_MINIMUM=3.5 -D GENF90_PATH='
+ srcroot
+ '/libraries/parallelio/scripts/ "'
)

stdargs = get_standard_makefile_args(case, shared_lib=True)

Expand Down
4 changes: 2 additions & 2 deletions CIME/tests/test_sys_bless_tests_results.py
Original file line number Diff line number Diff line change
Expand Up @@ -214,5 +214,5 @@ def test_rebless_namelist(self):

# Basic namelist compare should now pass again
self._create_test(compargs)

self.verify_perms(self._baseline_area)
if self._config.test_mode == "e3sm":
self.verify_perms(self._baseline_area)
Loading
Loading