summaryrefslogtreecommitdiff
path: root/lib/spack/spack/hooks/sbang.py
diff options
context:
space:
mode:
Diffstat (limited to 'lib/spack/spack/hooks/sbang.py')
-rw-r--r--lib/spack/spack/hooks/sbang.py5
1 files changed, 5 insertions, 0 deletions
diff --git a/lib/spack/spack/hooks/sbang.py b/lib/spack/spack/hooks/sbang.py
index 33aa29691f..8b99ee7873 100644
--- a/lib/spack/spack/hooks/sbang.py
+++ b/lib/spack/spack/hooks/sbang.py
@@ -126,6 +126,11 @@ def filter_shebangs_in_directory(directory, filenames=None):
if not os.path.isfile(path):
continue
+ # only handle executable files
+ st = os.stat(path)
+ if not st.st_mode & (stat.S_IXUSR | stat.S_IXGRP | stat.S_IXOTH):
+ continue
+
# only handle links that resolve within THIS package's prefix.
if os.path.islink(path):
real_path = os.path.realpath(path)