init: make spack.cmd.all_commands lazy

- `spack.cmd.all_commands` does a directory listing on
  `lib/spack/spack/cmd`, regardless of whether it is needed

- make this lazy so that the directory listing won't happen unless it's
  necessary.
This commit is contained in:
Todd Gamblin
2018-05-12 22:19:11 -07:00
committed by scheibelp
parent 1fe5dbf338
commit 3493f7e793
5 changed files with 27 additions and 11 deletions

View File

@@ -77,7 +77,8 @@
# Find all the `cmd-spack-*` references and add them to a command index
#
import spack
command_names = spack.cmd.all_commands
import spack.cmd
command_names = spack.cmd.all_commands()
documented_commands = set()
for filename in glob('*rst'):
with open(filename) as f: