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.
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user