From 5f675340fff98c7a006f6664e05c62a6c7677020 Mon Sep 17 00:00:00 2001 From: Jason Boutte Date: Tue, 23 Jan 2024 17:40:24 -0800 Subject: [PATCH] Converts to pathlib --- CIME/XML/machines.py | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/CIME/XML/machines.py b/CIME/XML/machines.py index 0fab6dc14e3..dc56b290ccf 100644 --- a/CIME/XML/machines.py +++ b/CIME/XML/machines.py @@ -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__) @@ -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,