deal with case where symbolic links are copied (#6178)
* deal with case where symbolic links are copied * Suggested changes
This commit is contained in:
parent
acc3817ffc
commit
124b5fc296
1 changed files with 9 additions and 0 deletions
|
@ -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:
|
||||
|
|
Loading…
Reference in a new issue