deal with case where symbolic links are copied (#6178)

* deal with case where symbolic links are copied

* Suggested changes
This commit is contained in:
Patrick Gartung 2017-11-09 16:38:12 -06:00 committed by Todd Gamblin
parent acc3817ffc
commit 124b5fc296

View file

@ -196,6 +196,11 @@ def change_sed_delimiter(old_delim, new_delim, *filenames):
def set_install_permissions(path):
"""Set appropriate permissions on the installed file."""
# If this points to a file maintained in a Spack prefix, it is assumed that
# this function will be invoked on the target. If the file is outside a
# Spack-maintained prefix, the permissions should not be modified.
if os.path.islink(path):
return
if os.path.isdir(path):
os.chmod(path, 0o755)
else:
@ -203,6 +208,10 @@ def set_install_permissions(path):
def copy_mode(src, dest):
"""Set the mode of dest to that of src unless it is a link.
"""
if os.path.islink(dest):
return
src_mode = os.stat(src).st_mode
dest_mode = os.stat(dest).st_mode
if src_mode & stat.S_IXUSR: