diff options
author | Matthew LeGendre <legendre1@llnl.gov> | 2016-01-25 10:52:17 -0800 |
---|---|---|
committer | Matthew LeGendre <legendre1@llnl.gov> | 2016-01-25 10:52:17 -0800 |
commit | fa888a4ba15176e9d415ffced41f6f16801f1938 (patch) | |
tree | f39f431b0bd37f385353c62d0f6ce1a981abff3f /bin | |
parent | fac4428766fb0a6b6cd357b654215f55df1220d4 (diff) | |
parent | 04a8439c39e674abb89d7a3f8dea82810c7ca682 (diff) | |
download | spack-fa888a4ba15176e9d415ffced41f6f16801f1938.tar.gz spack-fa888a4ba15176e9d415ffced41f6f16801f1938.tar.bz2 spack-fa888a4ba15176e9d415ffced41f6f16801f1938.tar.xz spack-fa888a4ba15176e9d415ffced41f6f16801f1938.zip |
Merge branch 'develop' into features/external-packages
Conflicts:
lib/spack/spack/cmd/mirror.py
lib/spack/spack/concretize.py
lib/spack/spack/config.py
lib/spack/spack/spec.py
lib/spack/spack/stage.py
var/spack/packages/mvapich2/package.py
Diffstat (limited to 'bin')
-rwxr-xr-x | bin/spack | 40 | ||||
-rwxr-xr-x | bin/spack-python | 2 |
2 files changed, 36 insertions, 6 deletions
@@ -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 |