diff options
author | Patrick Gartung <gartung@fnal.gov> | 2017-11-09 16:38:12 -0600 |
---|---|---|
committer | Todd Gamblin <tgamblin@llnl.gov> | 2017-11-09 14:38:12 -0800 |
commit | 124b5fc296687331f5456bcd3db647efe3747ed2 (patch) | |
tree | a80763fc6a0576650a34c179611f2a61dd500dd6 /lib | |
parent | acc3817ffc2055afdb659deb1ea9400ef3e90397 (diff) | |
download | spack-124b5fc296687331f5456bcd3db647efe3747ed2.tar.gz spack-124b5fc296687331f5456bcd3db647efe3747ed2.tar.bz2 spack-124b5fc296687331f5456bcd3db647efe3747ed2.tar.xz spack-124b5fc296687331f5456bcd3db647efe3747ed2.zip |
deal with case where symbolic links are copied (#6178)
* deal with case where symbolic links are copied
* Suggested changes
Diffstat (limited to 'lib')
-rw-r--r-- | lib/spack/llnl/util/filesystem.py | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/lib/spack/llnl/util/filesystem.py b/lib/spack/llnl/util/filesystem.py index eb4f6e3bf2..36be87580c 100644 --- a/lib/spack/llnl/util/filesystem.py +++ b/lib/spack/llnl/util/filesystem.py @@ -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: |