summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorTodd Gamblin <tgamblin@llnl.gov>2016-06-20 10:45:42 -0700
committerGitHub <noreply@github.com>2016-06-20 10:45:42 -0700
commit42ff1aaa7567efa8513920cbab665f84f7464746 (patch)
tree878c09fb6bba9011873360a78a1fd4f7d9099b56 /lib
parent31bb47356f35c284a29ff0333a9e60c8c36e7839 (diff)
parentd4df4375d561dfd7d31069e2801a9405ab06be63 (diff)
downloadspack-42ff1aaa7567efa8513920cbab665f84f7464746.tar.gz
spack-42ff1aaa7567efa8513920cbab665f84f7464746.tar.bz2
spack-42ff1aaa7567efa8513920cbab665f84f7464746.tar.xz
spack-42ff1aaa7567efa8513920cbab665f84f7464746.zip
Merge pull request #1064 from LLNL/bugfix/github-1043-script-backup
do not create shebang.bak file
Diffstat (limited to 'lib')
-rw-r--r--lib/spack/spack/hooks/sbang.py8
1 files changed, 1 insertions, 7 deletions
diff --git a/lib/spack/spack/hooks/sbang.py b/lib/spack/spack/hooks/sbang.py
index 83d67ea225..cb0ad42b14 100644
--- a/lib/spack/spack/hooks/sbang.py
+++ b/lib/spack/spack/hooks/sbang.py
@@ -24,7 +24,6 @@
##############################################################################
import os
-from llnl.util.filesystem import *
import llnl.util.tty as tty
import spack
@@ -34,6 +33,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 +57,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)