summaryrefslogtreecommitdiff
path: root/bin
diff options
context:
space:
mode:
Diffstat (limited to 'bin')
-rwxr-xr-xbin/sbang11
-rwxr-xr-xbin/spack20
2 files changed, 25 insertions, 6 deletions
diff --git a/bin/sbang b/bin/sbang
index f6b6d35e8a..1ea5f06592 100755
--- a/bin/sbang
+++ b/bin/sbang
@@ -79,6 +79,15 @@
# Obviously, for this to work, `sbang` needs to have a short enough
# path that *it* will run without hitting OS limits.
#
+# For Lua, scripts the second line can't start with #!, as # is not
+# the comment character in lua (even though lua ignores #! on the
+# *first* line of a script). So, instrument a lua script like this,
+# using -- instead of # on the second line:
+#
+# 1 #!/bin/bash /path/to/sbang
+# 2 --!/long/path/to/lua with arguments
+# 3
+# 4 print "success!"
#
# How it works
# -----------------------------
@@ -95,6 +104,8 @@ lines=0
while read line && ((lines < 2)) ; do
if [[ "$line" = '#!'* ]]; then
interpreter="${line#\#!}"
+ elif [[ "$line" = '--!'*lua* ]]; then
+ interpreter="${line#--!}"
fi
lines=$((lines+1))
done < "$script"
diff --git a/bin/spack b/bin/spack
index 3544feb10a..9fed11f33b 100755
--- a/bin/spack
+++ b/bin/spack
@@ -1,4 +1,5 @@
#!/usr/bin/env python
+# flake8: noqa
##############################################################################
# Copyright (c) 2013-2016, Lawrence Livermore National Security, LLC.
# Produced at the Lawrence Livermore National Laboratory.
@@ -24,9 +25,10 @@
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
##############################################################################
import sys
-if not sys.version_info[:2] >= (2,6):
+if not sys.version_info[:2] >= (2, 6):
v_info = sys.version_info[:3]
- sys.exit("Spack requires Python 2.6 or higher. This is Python %d.%d.%d." % v_info)
+ sys.exit("Spack requires Python 2.6 or higher. "
+ "This is Python %d.%d.%d." % v_info)
import os
@@ -62,7 +64,8 @@ for pyc_file in orphaned_pyc_files:
try:
os.remove(pyc_file)
except OSError as e:
- print "WARNING: Spack may fail mysteriously. Couldn't remove orphaned .pyc file: %s" % pyc_file
+ print ("WARNING: Spack may fail mysteriously. "
+ "Couldn't remove orphaned .pyc file: %s" % pyc_file)
# If there is no working directory, use the spack prefix.
try:
@@ -77,7 +80,7 @@ import llnl.util.tty as tty
from llnl.util.tty.color import *
import spack
from spack.error import SpackError
-from external import argparse
+import argparse
# Command parsing
parser = argparse.ArgumentParser(
@@ -128,6 +131,7 @@ if len(sys.argv) == 1:
# actually parse the args.
args = parser.parse_args()
+
def main():
# Set up environment based on args.
tty.set_verbose(args.verbose)
@@ -138,6 +142,9 @@ def main():
import spack.util.debug as debug
debug.register_interrupt_handler()
+ from spack.yaml_version_check import check_yaml_versions
+ check_yaml_versions()
+
spack.spack_working_dir = working_dir
if args.mock:
from spack.repository import RepoPath
@@ -145,7 +152,7 @@ def main():
# If the user asked for it, don't check ssl certs.
if args.insecure:
- tty.warn("You asked for --insecure, which does not check SSL certificates.")
+ tty.warn("You asked for --insecure. Will NOT check SSL certificates.")
spack.curl.add_default_arg('-k')
# Try to load the particular command asked for and run it
@@ -164,7 +171,8 @@ def main():
elif isinstance(return_val, int):
sys.exit(return_val)
else:
- tty.die("Bad return value from command %s: %s" % (args.command, return_val))
+ tty.die("Bad return value from command %s: %s"
+ % (args.command, return_val))
if args.profile:
import cProfile