Skip to content

Commit

Permalink
replace distutils (deprecated in python 3.12)
Browse files Browse the repository at this point in the history
  • Loading branch information
jedwards4b committed Sep 30, 2024
1 parent b8fce66 commit cf996bf
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion CIME/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit cf996bf

Please sign in to comment.