From cf996bf00dc344c0254f54735b065414d240d7fd Mon Sep 17 00:00:00 2001 From: Jim Edwards Date: Mon, 30 Sep 2024 13:30:14 -0600 Subject: [PATCH] replace distutils (deprecated in python 3.12) --- CIME/utils.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/CIME/utils.py b/CIME/utils.py index 1e280aa775f..59cbf3c7666 100644 --- a/CIME/utils.py +++ b/CIME/utils.py @@ -1417,13 +1417,18 @@ def safe_copy(src_path, tgt_path, preserve_meta=True): # I am not the owner, just copy file contents shutil.copyfile(src_path, tgt_path) - else: + elif preserve_meta: # We are making a new file, copy file contents, permissions, and metadata. # This can fail if the underlying directory is not writable by current user. shutil.copy2( src_path, tgt_path, ) + else: + shutil.copy( + src_path, + tgt_path, + ) # If src file was executable, then the tgt file should be too st = os.stat(tgt_path)