Skip to content

Commit

Permalink
Converts to pathlib
Browse files Browse the repository at this point in the history
  • Loading branch information
jasonb5 committed Jan 24, 2024
1 parent a127d2d commit 5f67534
Showing 1 changed file with 8 additions and 7 deletions.
15 changes: 8 additions & 7 deletions CIME/XML/machines.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
from CIME.utils import convert_to_unknown_type, get_cime_config

import socket
from pathlib import Path

logger = logging.getLogger(__name__)

Expand Down Expand Up @@ -317,20 +318,20 @@ def set_machine(self, machine, schema=None):
if machine == "Query":
return machine
elif self.get_version() == 3:
machines_file = os.path.join(
os.environ.get("HOME"), ".cime", machine, "config_machines.xml"
)
if os.path.isfile(machines_file):
machines_file = Path.home() / ".cime" / machine / "config_machines.xml"

if machines_file.exists():
GenericXML.read(
self,
machines_file,
schema=schema,
)
else:
machines_file = os.path.join(
self.machines_dir, machine, "config_machines.xml"
machines_file = (
Path(self.machines_dir) / machine / "config_machines.xml"
)
if os.path.isfile(machines_file):

if machines_file.exists():
GenericXML.read(
self,
machines_file,
Expand Down

0 comments on commit 5f67534

Please sign in to comment.