diff options
Diffstat (limited to 'bin')
-rwxr-xr-x | bin/spack | 26 | ||||
-rwxr-xr-x | bin/spack-python | 2 |
2 files changed, 25 insertions, 3 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,23 @@ 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) + +# 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 +89,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', @@ -131,7 +150,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 +161,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 |