summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGregory L. Lee <lee218@llnl.gov>2016-06-15 20:21:02 -0700
committerGregory L. Lee <lee218@llnl.gov>2016-06-15 20:21:02 -0700
commit1724ff565877eb36267d6947c0d900609b1bd198 (patch)
tree8d575e5e65821f1c937ad00ea8b87f1c3c2c2570
parentc803f7ae98dd7a1762e4eda89145e6ca50091136 (diff)
downloadspack-1724ff565877eb36267d6947c0d900609b1bd198.tar.gz
spack-1724ff565877eb36267d6947c0d900609b1bd198.tar.bz2
spack-1724ff565877eb36267d6947c0d900609b1bd198.tar.xz
spack-1724ff565877eb36267d6947c0d900609b1bd198.zip
do not create shebang.bak file
-rw-r--r--lib/spack/spack/hooks/sbang.py7
1 files changed, 1 insertions, 6 deletions
diff --git a/lib/spack/spack/hooks/sbang.py b/lib/spack/spack/hooks/sbang.py
index 83d67ea225..601c2420b5 100644
--- a/lib/spack/spack/hooks/sbang.py
+++ b/lib/spack/spack/hooks/sbang.py
@@ -34,6 +34,7 @@ import spack.modules
# here, as it is the shortest I could find on a modern OS.
shebang_limit = 127
+
def shebang_too_long(path):
"""Detects whether a file has a shebang line that is too long."""
with open(path, 'r') as script:
@@ -57,16 +58,10 @@ def filter_shebang(path):
if original.startswith(new_sbang_line):
return
- backup = path + ".shebang.bak"
- os.rename(path, backup)
-
with open(path, 'w') as new_file:
new_file.write(new_sbang_line)
new_file.write(original)
- copy_mode(backup, path)
- unset_executable_mode(backup)
-
tty.warn("Patched overly long shebang in %s" % path)