summaryrefslogtreecommitdiff
path: root/bin
diff options
context:
space:
mode:
Diffstat (limited to 'bin')
-rwxr-xr-xbin/spack40
-rwxr-xr-xbin/spack-python2
2 files changed, 36 insertions, 6 deletions
diff --git a/bin/spack b/bin/spack
index 5c042edd2d..93263217ac 100755
--- a/bin/spack
+++ b/bin/spack
@@ -7,7 +7,7 @@
# Written by Todd Gamblin, tgamblin@llnl.gov, All rights reserved.
# LLNL-CODE-647188
#
-# For details, see https://scalability-llnl.github.io/spack
+# For details, see https://github.com/llnl/spack
# Please also see the LICENSE file for our notice and the LGPL.
#
# This program is free software; you can redistribute it and/or modify
@@ -38,6 +38,31 @@ SPACK_PREFIX = os.path.dirname(os.path.dirname(SPACK_FILE))
# Allow spack libs to be imported in our scripts
SPACK_LIB_PATH = os.path.join(SPACK_PREFIX, "lib", "spack")
sys.path.insert(0, SPACK_LIB_PATH)
+SPACK_EXTERNAL_LIBS = os.path.join(SPACK_LIB_PATH, "external")
+sys.path.insert(0, SPACK_EXTERNAL_LIBS)
+
+import warnings
+# Avoid warnings when nose is installed with the python exe being used to run
+# spack. Note this must be done after Spack's external libs directory is added
+# to sys.path.
+with warnings.catch_warnings():
+ warnings.filterwarnings("ignore", ".*nose was already imported")
+ import nose
+
+# Quick and dirty check to clean orphaned .pyc files left over from
+# previous revisions. These files were present in earlier versions of
+# Spack, were removed, but shadow system modules that Spack still
+# imports. If we leave them, Spack will fail in mysterious ways.
+# TODO: more elegant solution for orphaned pyc files.
+orphaned_pyc_files = [os.path.join(SPACK_EXTERNAL_LIBS, n)
+ for n in ('functools.pyc', 'ordereddict.pyc')]
+for pyc_file in orphaned_pyc_files:
+ if not os.path.exists(pyc_file):
+ continue
+ try:
+ os.remove(pyc_file)
+ except OSError as e:
+ print "WARNING: Spack may fail mysteriously. Couldn't remove orphaned .pyc file: %s" % pyc
# If there is no working directory, use the spack prefix.
try:
@@ -72,6 +97,8 @@ spec expressions:
parser.add_argument('-d', '--debug', action='store_true',
help="Write out debug logs during compile")
+parser.add_argument('-D', '--pdb', action='store_true',
+ help="Run spack under the pdb debugger")
parser.add_argument('-k', '--insecure', action='store_true',
help="Do not check ssl certificates when downloading.")
parser.add_argument('-m', '--mock', action='store_true',
@@ -113,12 +140,12 @@ def main():
spack.spack_working_dir = working_dir
if args.mock:
- from spack.packages import PackageDB
- spack.db = PackageDB(spack.mock_packages_path)
+ from spack.repository import RepoPath
+ spack.repo.swap(RepoPath(spack.mock_packages_path))
# 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 or checksums.")
+ tty.warn("You asked for --insecure, which does not check SSL certificates.")
spack.curl.add_default_arg('-k')
# Try to load the particular command asked for and run it
@@ -131,7 +158,7 @@ def main():
sys.stderr.write('\n')
tty.die("Keyboard interrupt.")
- # Allow commands to return values if they want to exit with some ohter code.
+ # Allow commands to return values if they want to exit with some other code.
if return_val is None:
sys.exit(0)
elif isinstance(return_val, int):
@@ -142,5 +169,8 @@ def main():
if args.profile:
import cProfile
cProfile.run('main()', sort='tottime')
+elif args.pdb:
+ import pdb
+ pdb.run('main()')
else:
main()
diff --git a/bin/spack-python b/bin/spack-python
index 8a4b9c175d..e0745e8c58 100755
--- a/bin/spack-python
+++ b/bin/spack-python
@@ -7,7 +7,7 @@
# Written by Todd Gamblin, tgamblin@llnl.gov, All rights reserved.
# LLNL-CODE-647188
#
-# For details, see https://scalability-llnl.github.io/spack
+# For details, see https://github.com/llnl/spack
# Please also see the LICENSE file for our notice and the LGPL.
#
# This program is free software; you can redistribute it and/or modify