diff options
author | Todd Gamblin <tgamblin@llnl.gov> | 2020-01-28 21:31:53 -0800 |
---|---|---|
committer | Todd Gamblin <tgamblin@llnl.gov> | 2020-02-12 16:45:41 -0800 |
commit | a7b43f1015a0559705f2714a680aa9f87313e603 (patch) | |
tree | 27f00358340dbadbf17a490d9cce02fdda5fd607 /share | |
parent | 90f3635afd5d4079631460535bcd8213945b0349 (diff) | |
download | spack-a7b43f1015a0559705f2714a680aa9f87313e603.tar.gz spack-a7b43f1015a0559705f2714a680aa9f87313e603.tar.bz2 spack-a7b43f1015a0559705f2714a680aa9f87313e603.tar.xz spack-a7b43f1015a0559705f2714a680aa9f87313e603.zip |
spack python: add -m option to run modules as scripts
It's often useful to run a module with `python -m`, e.g.:
python -m pyinstrument script.py
Running a python script this way was hard, though, as `spack python` did
not have a similar `-m` option. This PR adds a `-m` option to `spack
python` so that we can do things like this:
spack python -m pyinstrument ./test.py
This makes it easy to write a script that uses a small part of Spack and
then profile it. Previously thee easiest way to do this was to write a
custom Spack command, which is often overkill.
Diffstat (limited to 'share')
-rwxr-xr-x | share/spack/spack-completion.bash | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/share/spack/spack-completion.bash b/share/spack/spack-completion.bash index e6b7529452..b17733e1bf 100755 --- a/share/spack/spack-completion.bash +++ b/share/spack/spack-completion.bash @@ -1272,7 +1272,7 @@ _spack_pydoc() { _spack_python() { if $list_options then - SPACK_COMPREPLY="-h --help -c" + SPACK_COMPREPLY="-h --help -c -m" else SPACK_COMPREPLY="" fi |