summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorTodd Gamblin <tgamblin@llnl.gov>2016-03-01 23:57:34 -0800
committerTodd Gamblin <tgamblin@llnl.gov>2016-03-01 23:57:34 -0800
commitc488f7c4d8e2ff240d561820df11a51518199a53 (patch)
tree7e6b9ad33f6bd3a77db8d327271bb1e22b8d616b /lib
parent21181075b40367b3fa9891c51930c7aedcfab4bf (diff)
downloadspack-c488f7c4d8e2ff240d561820df11a51518199a53.tar.gz
spack-c488f7c4d8e2ff240d561820df11a51518199a53.tar.bz2
spack-c488f7c4d8e2ff240d561820df11a51518199a53.tar.xz
spack-c488f7c4d8e2ff240d561820df11a51518199a53.zip
Fix bug in install permission setting.
Diffstat (limited to 'lib')
-rw-r--r--lib/spack/llnl/util/filesystem.py11
1 files changed, 8 insertions, 3 deletions
diff --git a/lib/spack/llnl/util/filesystem.py b/lib/spack/llnl/util/filesystem.py
index 24cfbfde71..da3cf96050 100644
--- a/lib/spack/llnl/util/filesystem.py
+++ b/lib/spack/llnl/util/filesystem.py
@@ -152,15 +152,20 @@ def set_install_permissions(path):
def copy_mode(src, dest):
src_mode = os.stat(src).st_mode
dest_mode = os.stat(dest).st_mode
- if src_mode | stat.S_IXUSR: dest_mode |= stat.S_IXUSR
- if src_mode | stat.S_IXGRP: dest_mode |= stat.S_IXGRP
- if src_mode | stat.S_IXOTH: dest_mode |= stat.S_IXOTH
+ if src_mode & stat.S_IXUSR: dest_mode |= stat.S_IXUSR
+ if src_mode & stat.S_IXGRP: dest_mode |= stat.S_IXGRP
+ if src_mode & stat.S_IXOTH: dest_mode |= stat.S_IXOTH
os.chmod(dest, dest_mode)
def install(src, dest):
"""Manually install a file to a particular location."""
tty.debug("Installing %s to %s" % (src, dest))
+
+ # Expand dsst to its eventual full path if it is a directory.
+ if os.path.isdir(dest):
+ dest = join_path(dest, os.path.basename(src))
+
shutil.copy(src, dest)
set_install_permissions(dest)
copy_mode(src, dest)