summaryrefslogtreecommitdiff
path: root/lib/spack/spack/cmd/mark.py
diff options
context:
space:
mode:
Diffstat (limited to 'lib/spack/spack/cmd/mark.py')
-rw-r--r--lib/spack/spack/cmd/mark.py52
1 files changed, 32 insertions, 20 deletions
diff --git a/lib/spack/spack/cmd/mark.py b/lib/spack/spack/cmd/mark.py
index da31917c39..1fba272ac9 100644
--- a/lib/spack/spack/cmd/mark.py
+++ b/lib/spack/spack/cmd/mark.py
@@ -28,29 +28,40 @@ error_message = """You can either:
# Arguments for display_specs when we find ambiguity
display_args = {
- 'long': True,
- 'show_flags': False,
- 'variants': False,
- 'indent': 4,
+ "long": True,
+ "show_flags": False,
+ "variants": False,
+ "indent": 4,
}
def setup_parser(subparser):
- arguments.add_common_arguments(
- subparser, ['installed_specs'])
+ arguments.add_common_arguments(subparser, ["installed_specs"])
subparser.add_argument(
- '-a', '--all', action='store_true', dest='all',
+ "-a",
+ "--all",
+ action="store_true",
+ dest="all",
help="Mark ALL installed packages that match each "
"supplied spec. If you `mark --all libelf`,"
" ALL versions of `libelf` are marked. If no spec is "
- "supplied, all installed packages will be marked.")
+ "supplied, all installed packages will be marked.",
+ )
exim = subparser.add_mutually_exclusive_group(required=True)
exim.add_argument(
- '-e', '--explicit', action='store_true', dest='explicit',
- help="Mark packages as explicitly installed.")
+ "-e",
+ "--explicit",
+ action="store_true",
+ dest="explicit",
+ help="Mark packages as explicitly installed.",
+ )
exim.add_argument(
- '-i', '--implicit', action='store_true', dest='implicit',
- help="Mark packages as implicitly installed.")
+ "-i",
+ "--implicit",
+ action="store_true",
+ dest="implicit",
+ help="Mark packages as implicitly installed.",
+ )
def find_matching_specs(specs, allow_multiple_matches=False):
@@ -74,17 +85,16 @@ def find_matching_specs(specs, allow_multiple_matches=False):
# For each spec provided, make sure it refers to only one package.
# Fail and ask user to be unambiguous if it doesn't
if not allow_multiple_matches and len(matching) > 1:
- tty.error('{0} matches multiple packages:'.format(spec))
- sys.stderr.write('\n')
- spack.cmd.display_specs(matching, output=sys.stderr,
- **display_args)
- sys.stderr.write('\n')
+ tty.error("{0} matches multiple packages:".format(spec))
+ sys.stderr.write("\n")
+ spack.cmd.display_specs(matching, output=sys.stderr, **display_args)
+ sys.stderr.write("\n")
sys.stderr.flush()
has_errors = True
# No installed package matches the query
if len(matching) == 0 and spec is not any:
- tty.die('{0} does not match any installed packages.'.format(spec))
+ tty.die("{0} does not match any installed packages.".format(spec))
specs_from_cli.extend(matching)
@@ -114,8 +124,10 @@ def mark_specs(args, specs):
def mark(parser, args):
if not args.specs and not args.all:
- tty.die('mark requires at least one package argument.',
- ' Use `spack mark --all` to mark ALL packages.')
+ tty.die(
+ "mark requires at least one package argument.",
+ " Use `spack mark --all` to mark ALL packages.",
+ )
# [any] here handles the --all case by forcing all specs to be returned
specs = spack.cmd.parse_specs(args.specs) if args.specs else [any]