commands: rework command categories and arguments
- split 'environment' section into 'environments' and 'modules' - move location to 'query packages' section - move cd to developer section - --env-dir no longer has a short optino (was -E) - -E now means "run without an environment" (no longer same as --env-dir) - -D now means "run with this directory environment" - remove short options for may infrequently used top-level commands
This commit is contained in:
parent
efad7ac81b
commit
1137b183e3
@ -12,7 +12,7 @@
|
|||||||
|
|
||||||
|
|
||||||
description = 'add a spec to an environment'
|
description = 'add a spec to an environment'
|
||||||
section = "environment"
|
section = "environments"
|
||||||
level = "long"
|
level = "long"
|
||||||
|
|
||||||
|
|
||||||
|
@ -8,7 +8,7 @@
|
|||||||
import spack.cmd.location
|
import spack.cmd.location
|
||||||
|
|
||||||
description = "cd to spack directories in the shell"
|
description = "cd to spack directories in the shell"
|
||||||
section = "environment"
|
section = "developer"
|
||||||
level = "long"
|
level = "long"
|
||||||
|
|
||||||
|
|
||||||
|
@ -6,7 +6,7 @@
|
|||||||
import spack.environment as ev
|
import spack.environment as ev
|
||||||
|
|
||||||
description = 'concretize an environment and write a lockfile'
|
description = 'concretize an environment and write a lockfile'
|
||||||
section = "environment"
|
section = "environments"
|
||||||
level = "long"
|
level = "long"
|
||||||
|
|
||||||
|
|
||||||
|
@ -21,8 +21,8 @@
|
|||||||
import spack.util.string as string
|
import spack.util.string as string
|
||||||
|
|
||||||
description = "manage virtual environments"
|
description = "manage virtual environments"
|
||||||
section = "environment"
|
section = "environments"
|
||||||
level = "long"
|
level = "short"
|
||||||
|
|
||||||
|
|
||||||
#: List of subcommands of `spack env`
|
#: List of subcommands of `spack env`
|
||||||
|
@ -7,7 +7,7 @@
|
|||||||
from spack.cmd.common import print_module_placeholder_help, arguments
|
from spack.cmd.common import print_module_placeholder_help, arguments
|
||||||
|
|
||||||
description = "add package to environment using `module load`"
|
description = "add package to environment using `module load`"
|
||||||
section = "environment"
|
section = "modules"
|
||||||
level = "short"
|
level = "short"
|
||||||
|
|
||||||
|
|
||||||
|
@ -14,8 +14,8 @@
|
|||||||
import spack.paths
|
import spack.paths
|
||||||
import spack.repo
|
import spack.repo
|
||||||
|
|
||||||
description = "print out locations of various directories used by Spack"
|
description = "print out locations of packages and spack directories"
|
||||||
section = "environment"
|
section = "basic"
|
||||||
level = "long"
|
level = "long"
|
||||||
|
|
||||||
|
|
||||||
|
@ -20,7 +20,7 @@
|
|||||||
from spack.error import SpackError
|
from spack.error import SpackError
|
||||||
from spack.util.spack_yaml import syaml_dict
|
from spack.util.spack_yaml import syaml_dict
|
||||||
|
|
||||||
description = "manage mirrors"
|
description = "manage mirrors (source and binary)"
|
||||||
section = "config"
|
section = "config"
|
||||||
level = "long"
|
level = "long"
|
||||||
|
|
||||||
|
@ -12,7 +12,7 @@
|
|||||||
import spack.cmd.modules.tcl
|
import spack.cmd.modules.tcl
|
||||||
|
|
||||||
description = "manipulate module files"
|
description = "manipulate module files"
|
||||||
section = "environment"
|
section = "modules"
|
||||||
level = "short"
|
level = "short"
|
||||||
|
|
||||||
|
|
||||||
|
@ -12,7 +12,7 @@
|
|||||||
|
|
||||||
|
|
||||||
description = 'remove specs from an environment'
|
description = 'remove specs from an environment'
|
||||||
section = "environment"
|
section = "environments"
|
||||||
level = "long"
|
level = "long"
|
||||||
|
|
||||||
|
|
||||||
|
@ -7,7 +7,7 @@
|
|||||||
from spack.cmd.common import print_module_placeholder_help
|
from spack.cmd.common import print_module_placeholder_help
|
||||||
|
|
||||||
description = "remove package from environment using `module unload`"
|
description = "remove package from environment using `module unload`"
|
||||||
section = "environment"
|
section = "modules"
|
||||||
level = "short"
|
level = "short"
|
||||||
|
|
||||||
|
|
||||||
|
@ -7,7 +7,7 @@
|
|||||||
from spack.cmd.common import print_module_placeholder_help
|
from spack.cmd.common import print_module_placeholder_help
|
||||||
|
|
||||||
description = "remove package from environment using dotkit"
|
description = "remove package from environment using dotkit"
|
||||||
section = "environment"
|
section = "modules"
|
||||||
level = "long"
|
level = "long"
|
||||||
|
|
||||||
|
|
||||||
|
@ -7,7 +7,7 @@
|
|||||||
from spack.cmd.common import print_module_placeholder_help, arguments
|
from spack.cmd.common import print_module_placeholder_help, arguments
|
||||||
|
|
||||||
description = "add package to environment using dotkit"
|
description = "add package to environment using dotkit"
|
||||||
section = "environment"
|
section = "modules"
|
||||||
level = "long"
|
level = "long"
|
||||||
|
|
||||||
|
|
||||||
|
@ -43,7 +43,7 @@
|
|||||||
from spack.filesystem_view import YamlFilesystemView
|
from spack.filesystem_view import YamlFilesystemView
|
||||||
|
|
||||||
description = "produce a single-rooted directory view of packages"
|
description = "produce a single-rooted directory view of packages"
|
||||||
section = "environment"
|
section = "environments"
|
||||||
level = "short"
|
level = "short"
|
||||||
|
|
||||||
actions_link = ["symlink", "add", "soft", "hardlink", "hard"]
|
actions_link = ["symlink", "add", "soft", "hardlink", "hard"]
|
||||||
|
@ -19,6 +19,7 @@
|
|||||||
from six import StringIO
|
from six import StringIO
|
||||||
|
|
||||||
import llnl.util.tty as tty
|
import llnl.util.tty as tty
|
||||||
|
import llnl.util.tty.color as color
|
||||||
from llnl.util.tty.log import log_output
|
from llnl.util.tty.log import log_output
|
||||||
|
|
||||||
import spack
|
import spack
|
||||||
@ -324,12 +325,12 @@ def make_argument_parser(**kwargs):
|
|||||||
help="when to colorize output (default: auto)")
|
help="when to colorize output (default: auto)")
|
||||||
parser.add_argument(
|
parser.add_argument(
|
||||||
'-C', '--config-scope', dest='config_scopes', action='append',
|
'-C', '--config-scope', dest='config_scopes', action='append',
|
||||||
metavar='DIRECTORY', help="use an additional configuration scope")
|
metavar='DIR', help="use an additional configuration scope")
|
||||||
parser.add_argument(
|
parser.add_argument(
|
||||||
'-d', '--debug', action='store_true',
|
'-d', '--debug', action='store_true',
|
||||||
help="write out debug logs during compile")
|
help="write out debug logs during compile")
|
||||||
parser.add_argument(
|
parser.add_argument(
|
||||||
'-D', '--pdb', action='store_true',
|
'--pdb', action='store_true',
|
||||||
help="run spack under the pdb debugger")
|
help="run spack under the pdb debugger")
|
||||||
|
|
||||||
env_group = parser.add_mutually_exclusive_group()
|
env_group = parser.add_mutually_exclusive_group()
|
||||||
@ -337,8 +338,11 @@ def make_argument_parser(**kwargs):
|
|||||||
'-e', '--env', dest='env', metavar='ENV', action='store',
|
'-e', '--env', dest='env', metavar='ENV', action='store',
|
||||||
help="run with a specific environment (see spack env)")
|
help="run with a specific environment (see spack env)")
|
||||||
env_group.add_argument(
|
env_group.add_argument(
|
||||||
'-E', '--env-dir', metavar='DIR', action='store',
|
'-D', '--env-dir', dest='env_dir', metavar='DIR', action='store',
|
||||||
help="run with an environment directory (ignore named environments)")
|
help="run with an environment directory (ignore named environments)")
|
||||||
|
env_group.add_argument(
|
||||||
|
'-E', '--no-env', dest='no_env', action='store_true',
|
||||||
|
help="run without any environments activated (see spack env)")
|
||||||
parser.add_argument(
|
parser.add_argument(
|
||||||
'--use-env-repo', action='store_true',
|
'--use-env-repo', action='store_true',
|
||||||
help="when running in an environment, use its package repository")
|
help="when running in an environment, use its package repository")
|
||||||
@ -359,7 +363,7 @@ def make_argument_parser(**kwargs):
|
|||||||
'-p', '--profile', action='store_true', dest='spack_profile',
|
'-p', '--profile', action='store_true', dest='spack_profile',
|
||||||
help="profile execution using cProfile")
|
help="profile execution using cProfile")
|
||||||
parser.add_argument(
|
parser.add_argument(
|
||||||
'-P', '--sorted-profile', default=None, metavar="STAT",
|
'--sorted-profile', default=None, metavar="STAT",
|
||||||
help="profile and sort by one or more of:\n[%s]" %
|
help="profile and sort by one or more of:\n[%s]" %
|
||||||
',\n '.join([', '.join(line) for line in stat_lines]))
|
',\n '.join([', '.join(line) for line in stat_lines]))
|
||||||
parser.add_argument(
|
parser.add_argument(
|
||||||
@ -369,7 +373,7 @@ def make_argument_parser(**kwargs):
|
|||||||
'-v', '--verbose', action='store_true',
|
'-v', '--verbose', action='store_true',
|
||||||
help="print additional output during builds")
|
help="print additional output during builds")
|
||||||
parser.add_argument(
|
parser.add_argument(
|
||||||
'-s', '--stacktrace', action='store_true',
|
'--stacktrace', action='store_true',
|
||||||
help="add stacktraces to all printed statements")
|
help="add stacktraces to all printed statements")
|
||||||
parser.add_argument(
|
parser.add_argument(
|
||||||
'-V', '--version', action='store_true',
|
'-V', '--version', action='store_true',
|
||||||
@ -410,7 +414,7 @@ def setup_main_options(args):
|
|||||||
spack.config.set('config:verify_ssl', False, scope='command_line')
|
spack.config.set('config:verify_ssl', False, scope='command_line')
|
||||||
|
|
||||||
# when to use color (takes always, auto, or never)
|
# when to use color (takes always, auto, or never)
|
||||||
tty.color.set_color_when(args.color)
|
color.set_color_when(args.color)
|
||||||
|
|
||||||
|
|
||||||
def allows_unknown_args(command):
|
def allows_unknown_args(command):
|
||||||
@ -622,6 +626,7 @@ def main(argv=None):
|
|||||||
args, unknown = parser.parse_known_args(argv)
|
args, unknown = parser.parse_known_args(argv)
|
||||||
|
|
||||||
# activate an environment if one was specified on the command line
|
# activate an environment if one was specified on the command line
|
||||||
|
if not args.no_env:
|
||||||
activate_environment(args.env, args.env_dir, args.use_env_repo)
|
activate_environment(args.env, args.env_dir, args.use_env_repo)
|
||||||
|
|
||||||
# make spack.config aware of any command line configuration scopes
|
# make spack.config aware of any command line configuration scopes
|
||||||
|
Loading…
Reference in New Issue
Block a user